OLD | NEW |
1 <link rel="import" href="chrome://resources/html/polymer.html"> | 1 <link rel="import" href="chrome://resources/html/polymer.html"> |
2 <link rel="import" href="chrome://resources/polymer/v1_0/iron-media-query/iron-m
edia-query.html"> | 2 <link rel="import" href="chrome://resources/polymer/v1_0/iron-media-query/iron-m
edia-query.html"> |
3 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper
-icon-button.html"> | 3 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper
-icon-button.html"> |
4 <link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar_se
arch_field.html"> | 4 <link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar_se
arch_field.html"> |
5 | 5 |
6 <dom-module id="cr-toolbar"> | 6 <dom-module id="cr-toolbar"> |
7 <template> | 7 <template> |
8 <style> | 8 <style> |
9 :host { | 9 :host { |
10 --cr-toolbar-field-width: 580px; | 10 --cr-toolbar-field-width: 580px; |
11 --cr-toolbar-height: 56px; | 11 --cr-toolbar-height: 56px; |
12 align-items: center; | 12 align-items: center; |
13 color: #fff; | 13 color: #fff; |
14 display: flex; | 14 display: flex; |
15 height: var(--cr-toolbar-height); | 15 height: var(--cr-toolbar-height); |
16 } | 16 } |
17 | 17 |
18 h1 { | 18 h1 { |
19 -webkit-margin-start: 6px; | 19 -webkit-margin-start: 6px; |
20 -webkit-padding-end: 2px; | 20 -webkit-padding-end: 12px; |
21 flex: 1; | 21 flex: 1; |
22 font-size: 123%; | 22 font-size: 123%; |
23 font-weight: 400; | 23 font-weight: 400; |
24 text-overflow: ellipsis; | 24 text-overflow: ellipsis; |
25 overflow: hidden; | 25 overflow: hidden; |
26 white-space: nowrap; | 26 white-space: nowrap; |
27 } | 27 } |
28 | 28 |
29 #leftContent { | 29 #leftContent { |
30 -webkit-padding-start: 18px; | 30 /* margin-start here must match margin-end on #rightContent. */ |
31 align-items: center; | 31 -webkit-margin-start: 12px; |
32 box-sizing: border-box; | |
33 display: flex; | |
34 position: absolute; | |
35 transition: opacity 100ms; | 32 transition: opacity 100ms; |
36 } | 33 } |
37 | 34 |
| 35 #leftSpacer { |
| 36 -webkit-margin-start: 6px; |
| 37 align-items: center; |
| 38 display: flex; |
| 39 } |
| 40 |
38 #menuButton { | 41 #menuButton { |
39 height: 32px; | 42 height: 32px; |
40 margin-bottom: 6px; | 43 margin-bottom: 6px; |
41 margin-top: 6px; | 44 margin-top: 6px; |
42 min-width: 32px; | 45 min-width: 32px; |
43 padding: 6px; | 46 padding: 6px; |
44 width: 32px; | 47 width: 32px; |
45 } | 48 } |
46 | 49 |
47 #centeredContent { | 50 #centeredContent { |
48 display: flex; | 51 display: flex; |
49 flex: 1 1 0; | 52 flex: 1 1 0; |
50 justify-content: center; | |
51 } | 53 } |
52 | 54 |
53 :host([narrow_]) #centeredContent { | 55 #rightContent { |
54 -webkit-padding-end: var(--cr-toolbar-field-end-padding, 12px); | 56 -webkit-margin-end: 12px; |
55 } | |
56 | |
57 :host(:not([narrow_])) h1 { | |
58 @apply(--cr-toolbar-header-wide); | |
59 } | |
60 | |
61 :host(:not([narrow_])) #leftContent { | |
62 /* The amount of space left of the search field: | |
63 (width of window - width of search field) / 2. */ | |
64 max-width: calc((100% - var(--cr-toolbar-field-width)) / 2); | |
65 @apply(--cr-toolbar-left-content-wide); | |
66 } | |
67 | |
68 :host(:not([narrow_])) #centeredContent { | |
69 -webkit-margin-start: var(--cr-toolbar-field-margin, 0); | |
70 } | |
71 | |
72 :host(:not([narrow_])) #rightContent { | |
73 @apply(--cr-toolbar-right-content-wide); | |
74 } | 57 } |
75 | 58 |
76 :host([narrow_]) #centeredContent { | 59 :host([narrow_]) #centeredContent { |
77 justify-content: flex-end; | 60 justify-content: flex-end; |
78 } | 61 } |
79 | 62 |
80 :host([narrow_][showing-search_]) #leftContent { | 63 :host([narrow_][showing-search_]) #leftContent { |
| 64 position: absolute; |
81 opacity: 0; | 65 opacity: 0; |
82 } | 66 } |
83 | 67 |
| 68 :host(:not([narrow_])) #leftContent { |
| 69 flex: 1 1 var(--cr-toolbar-field-margin, 0); |
| 70 } |
| 71 |
| 72 :host(:not([narrow_])) #rightContent { |
| 73 flex: 1 1 0; |
| 74 text-align: end; |
| 75 } |
| 76 |
84 #menuPromo { | 77 #menuPromo { |
85 -webkit-padding-end: 12px; | 78 -webkit-padding-end: 12px; |
86 -webkit-padding-start: 8px; | 79 -webkit-padding-start: 8px; |
87 align-items: center; | 80 align-items: center; |
88 background: #616161; | 81 background: #616161; |
89 border-radius: 2px; | 82 border-radius: 2px; |
90 color: white; | 83 color: white; |
91 display: flex; | 84 display: flex; |
92 font-size: 92.3%; | 85 font-size: 92.3%; |
93 font-weight: 500; | 86 font-weight: 500; |
94 opacity: 0; | 87 opacity: 0; |
95 padding-bottom: 6px; | 88 padding-bottom: 6px; |
96 padding-top: 6px; | 89 padding-top: 6px; |
97 position: absolute; | 90 position: absolute; |
98 top: var(--cr-toolbar-height); | 91 top: var(--cr-toolbar-height); |
99 white-space: nowrap; | 92 white-space: nowrap; |
100 z-index: 2; | 93 z-index: 2; |
101 } | 94 } |
102 | 95 |
103 #menuPromo::before { | 96 #menuPromo::before { |
104 background: inherit; | 97 background: inherit; |
105 /* Up arrow. 105% in Y coordinates fixes glitch at 110/125% zoom. */ | 98 /* Up arrow. 105% in Y coordinates fixes glitch at 110/125% zoom. */ |
106 clip-path: polygon(0 105%, 100% 105%, 50% 0); | 99 clip-path: polygon(0 105%, 100% 105%, 50% 0); |
107 content: ''; | 100 content: ''; |
108 display: block; | 101 display: block; |
109 left: 10px; | 102 left: 10px; |
110 height: 6px; | 103 height: 6px; |
111 position: absolute; | 104 position: absolute; |
112 top: -6px; | 105 top: -6px; |
113 width: 12px; | 106 width: 12px; |
114 } | 107 } |
115 | 108 |
116 :host-context([dir=rtl]) #menuPromo::before { | 109 :host-context([dir=rtl]) #menuPromo::before { |
117 left: auto; | 110 left: auto; |
118 right: 10px; | 111 right: 10px; |
119 } | 112 } |
120 | 113 |
121 #closePromo { | 114 #closePromo { |
122 -webkit-appearance: none; | 115 -webkit-appearance: none; |
123 -webkit-margin-start: 12px; | 116 -webkit-margin-start: 12px; |
124 background: none; | 117 background: none; |
125 border: none; | 118 border: none; |
126 color: inherit; | 119 color: inherit; |
127 font-size: 20px; /* Shouldn't change if default font-size changes. */ | 120 font-size: 20px; /* Shouldn't change if default font-size changes. */ |
128 line-height: 20px; | 121 line-height: 20px; |
129 padding: 0; | 122 padding: 0; |
130 width: 20px; | 123 width: 20px; |
131 } | 124 } |
132 </style> | 125 </style> |
133 <div id="leftContent"> | 126 <div id="leftContent"> |
134 <!-- Note: showing #menuPromo relies on this dom-if being [restamp]. --> | 127 <div id="leftSpacer"> |
135 <template is="dom-if" if="[[showMenu]]" restamp> | 128 <!-- Note: showing #menuPromo relies on this dom-if being [restamp]. --> |
136 <paper-icon-button id="menuButton" icon="cr:menu" on-tap="onMenuTap_" | 129 <template is="dom-if" if="[[showMenu]]" restamp> |
137 title="[[titleIfNotShowMenuPromo_(menuLabel, showMenuPromo)]]" | 130 <paper-icon-button id="menuButton" icon="cr:menu" on-tap="onMenuTap_" |
138 aria-label$="[[menuLabel]]"> | 131 title="[[titleIfNotShowMenuPromo_(menuLabel, showMenuPromo)]]" |
139 </paper-icon-button> | 132 aria-label$="[[menuLabel]]"> |
140 <template is="dom-if" if="[[showMenuPromo]]"> | 133 </paper-icon-button> |
141 <div id="menuPromo" role="tooltip"> | 134 <template is="dom-if" if="[[showMenuPromo]]"> |
142 [[menuPromo]] | 135 <div id="menuPromo" role="tooltip"> |
143 <button id="closePromo" on-tap="onClosePromoTap_" | 136 [[menuPromo]] |
144 aria-label$="[[closeMenuPromo]]">✕</button> | 137 <button id="closePromo" on-tap="onClosePromoTap_" |
145 </paper-tooltip> | 138 aria-label$="[[closeMenuPromo]]">✕</button> |
| 139 </paper-tooltip> |
| 140 </template> |
146 </template> | 141 </template> |
147 </template> | 142 <h1>[[pageName]]</h1> |
148 <h1>[[pageName]]</h1> | 143 </div> |
149 </div> | 144 </div> |
150 | 145 |
151 <div id="centeredContent"> | 146 <div id="centeredContent"> |
152 <cr-toolbar-search-field id="search" narrow="[[narrow_]]" | 147 <cr-toolbar-search-field id="search" narrow="[[narrow_]]" |
153 label="[[searchPrompt]]" clear-label="[[clearLabel]]" | 148 label="[[searchPrompt]]" clear-label="[[clearLabel]]" |
154 spinner-active="[[spinnerActive]]" | 149 spinner-active="[[spinnerActive]]" |
155 showing-search="{{showingSearch_}}"> | 150 showing-search="{{showingSearch_}}"> |
156 </cr-toolbar-search-field> | 151 </cr-toolbar-search-field> |
157 <iron-media-query query="(max-width: 900px)" query-matches="{{narrow_}}"> | 152 <iron-media-query query="(max-width: 900px)" query-matches="{{narrow_}}"> |
158 </iron-media-query> | 153 </iron-media-query> |
159 </div> | 154 </div> |
160 | 155 |
161 <div id="rightContent"> | 156 <div id="rightContent"> |
162 <content select=".more-actions"></content> | 157 <content select=".more-actions"></content> |
163 </div> | 158 </div> |
164 </template> | 159 </template> |
165 <script src="cr_toolbar.js"></script> | 160 <script src="cr_toolbar.js"></script> |
166 </dom-module> | 161 </dom-module> |
OLD | NEW |