summaryrefslogtreecommitdiff
path: root/chromium/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.html
blob: c8f6922e4f495c82bb7eddf4f3cfd2af875c2cb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<link rel="import" href="../../html/polymer.html">

<link rel="import" href="../cr_button/cr_button.html">
<link rel="import" href="../shared_vars_css.html">
<link rel="import" href="../../html/icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="cr_profile_avatar_selector_grid.html">

<dom-module id="cr-profile-avatar-selector">
  <template>
    <style>
      :host {
        --avatar-size: 96px;
        --avatar-spacing: 24px;
        display: inline-flex;
      }

      #avatar-grid .avatar {
        --avatar-focus-color: var(--google-grey-refresh-700);
        --avatar-gap-color: white;
        --avatar-gap-width: 2px;
        --avatar-selected-color: var(--google-blue-500);

        background-position: center;
        background-repeat: no-repeat;
        border: 1px solid var(--paper-grey-300);
        border-radius: 100%;
        box-shadow: 0 0 0 var(--avatar-gap-width) var(--avatar-gap-color),
            0 0 0 calc(var(--avatar-gap-width) + var(--avatar-outline-width))
                var(--avatar-outline-color);
        display: flex;
        height: var(--avatar-size);
        margin: calc(var(--avatar-spacing) / 2);
        min-width: 0;
        padding: 0;
        transition: none !important;  /* Polymer's :host([animated]) rule. */
        width: var(--avatar-size);
      }

      @media (prefers-color-scheme: dark) {
        #avatar-grid .avatar {
          --avatar-focus-color: var(--google-grey-refresh-500);
          --avatar-gap-color: var(--google-grey-800);
          --avatar-selected-color: var(--google-blue-refresh-300);
        }
      }

      #avatar-grid .avatar.iron-selected {
        --avatar-outline-color: var(--avatar-selected-color);
        --avatar-outline-width: 2px !important;  /* Overrides rule below. */
        border-color: var(--avatar-selected-color);
      }

      :host-context(.focus-outline-visible) #avatar-grid
          .avatar:not(.iron-selected):focus {
        --avatar-outline-color: var(--avatar-focus-color);
        --avatar-outline-width: 1px;
      }

      cr-button {
        background-size: var(--avatar-size);
      }
    </style>
    <cr-profile-avatar-selector-grid id="avatar-grid"
        ignore-modified-key-events="[[ignoreModifiedKeyEvents]]">
      <template is="dom-repeat" items="[[avatars]]">
        <cr-button class$="avatar [[getSelectedClass_(item.selected)]]"
            title="[[item.label]]"
            style$="background-image: [[getIconImageSet_(item.url)]]"
            on-click="onAvatarTap_">
        </cr-button>
      </template>
    </cr-profile-avatar-selector-grid>
  </template>
  <script src="cr_profile_avatar_selector.js"></script>
</dom-module>