summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/new_tab_page/modules/v2/history_clusters/header_tile.html
blob: ec7403613fb122299b29e1864f8d9c28c0c0e78a (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<style include="cr-icons cr-shared-style">
  :host {
    background: var(--color-new-tab-page-module-item-background);
    border-radius: var(--ntp-module-item-border-radius);
    display: flex;
    flex-direction: column;
    position: relative;
  }

  :host([suggestion-chip-header-enabled_]),
  :host([suggestion-chip-header-enabled_]) ntp-module-header-v2 {
    background: transparent;
    border: none;
  }

  @media (forced-colors: active) {
   /* Set outline since background isn't visible in hcm */
    :host {
      border-radius: var(--ntp-module-item-border-radius);
      outline: var(--cr-border-hcm);
    }
  }

  #container {
    background-color: var(--color-new-tab-page-module-item-background);
    border: none;
    border-radius: var(--ntp-module-item-border-radius);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
  }

  button {
    font-family: inherit;
  }

  ntp-module-header-v2 {
    padding-bottom: 8px;
    width: 100%;
  }

  h2 {
    text-align: start;
  }

  .label-container {
    color: var(--color-new-tab-page-primary-foreground);
    font-size: 20px;
    height: 48px;
    line-height: 24px;
    padding: 0 16px;
  }

  :host(:not([suggestion-chip-header-enabled_]):hover) {
    cursor: pointer;
  }

  :host(:not([suggestion-chip-header-enabled_]):hover) .hover-layer,
  #suggestion-chip:hover .hover-layer {
    background: var(--color-new-tab-page-module-item-background-hovered);
    display: block;
    inset: 0;
    position: absolute;
  }

  .hover-layer {
    border-radius: var(--ntp-module-item-border-radius);
    display: none;
    pointer-events: none;
  }

  :host([suggestion-chip-header-enabled_]) .label-container {
    background: var(--color-new-tab-page-module-item-background);
    border-radius: var(--ntp-module-item-border-radius);
  }

  :host([suggestion-chip-header-enabled_][format='wide']
      :not([show-related-searches])) .label-container {
    align-items: start;
  }

  h2 {
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    font-weight: inherit;
    font-size: inherit;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  :host([suggestion-chip-header-enabled_]) h2 {
    -webkit-line-clamp: 1;
  }

  #suggestion-chip {
    display: flex;
    font-size: var(--ntp-module-text-size);
    height: 100%;
    position: relative;
    text-decoration: none;
  }

  #container:focus-visible,
  #suggestion-chip:focus-visible {
    box-shadow: var(--ntp-focus-shadow);
    outline: none;
  }

  #suggestion-chip-icon {
    --cr-icon-ripple-size: 16px;
    --cr-icon-image: url(chrome://resources/images/icon_history.svg);
    align-self: center;
    background-color: var(--color-new-tab-page-primary-foreground);
    margin: 16px 0;
  }

  #suggestion-chip-label {
    align-self: center;
    margin-inline-start: 12px;
    line-height: 20px;
  }
</style>

<template is="dom-if" if="[[!suggestionChipHeaderEnabled_]]">
  <div class="hover-layer"></div>
  <button id="container" on-click="onClick_">
    <ntp-module-header-v2
        header-text="[[i18n('modulesJourneysResumeJourney', '')]]"
        on-menu-button-click="onMenuButtonClick_"
        menu-item-groups="[[getMenuItemGroups_()]]"
        more-actions-text="[[i18n('modulesMoreActions', clusterLabel)]]">
    </ntp-module-header-v2>
    <h2 id="label" class="label-container">
    [[clusterLabel]]
    </h2>
  </button>
</template>
<template is="dom-if" if="[[suggestionChipHeaderEnabled_]]">
  <ntp-module-header-v2
      header-text="[[i18n('modulesJourneysResumeJourney', '')]]"
      on-menu-button-click="onMenuButtonClick_"
      menu-item-groups="[[getMenuItemGroups_()]]"
      more-actions-text="[[i18n('modulesMoreActions', clusterLabel)]]">
  </ntp-module-header-v2>
  <a id="suggestion-chip" class="label-container" href="[[normalizedUrl.url]]"
      on-click="onSuggestClick_">
    <div class="hover-layer"></div>
    <div id="suggestion-chip-icon" class="cr-icon"></div>
    <h2 id="suggestion-chip-label">[[clusterLabel]]</h2>
  </a>
</template>