Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <link rel="import" href="chrome://resources/cr_elements/icons.html"> | 1 <link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.ht ml"> |
| 2 <link rel="import" href="chrome://resources/html/polymer.html"> | 2 <link rel="import" href="chrome://resources/html/polymer.html"> |
| 3 <link rel="import" href="chrome://resources/polymer/v1_0/paper-drawer-panel/pape r-drawer-panel.html"> | 3 <link rel="import" href="chrome://resources/polymer/v1_0/paper-drawer-panel/pape r-drawer-panel.html"> |
| 4 <link rel="import" href="chrome://resources/polymer/v1_0/paper-header-panel/pape r-header-panel.html"> | 4 <link rel="import" href="chrome://resources/polymer/v1_0/paper-header-panel/pape r-header-panel.html"> |
| 5 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper -icon-button.html"> | |
| 6 <link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input .html"> | |
| 7 <link rel="import" href="chrome://resources/polymer/v1_0/paper-toolbar/paper-too lbar.html"> | |
| 8 <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/classe s/iron-flex-layout.html"> | |
| 9 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> | |
| 10 <link rel="import" href="/direction_delegate.html"> | 5 <link rel="import" href="/direction_delegate.html"> |
| 11 <link rel="import" href="/i18n_setup.html"> | 6 <link rel="import" href="/i18n_setup.html"> |
| 12 <link rel="import" href="/icons.html"> | |
| 13 <link rel="import" href="/settings_main/settings_main.html"> | 7 <link rel="import" href="/settings_main/settings_main.html"> |
| 14 <link rel="import" href="/settings_menu/settings_menu.html"> | 8 <link rel="import" href="/settings_menu/settings_menu.html"> |
| 15 <link rel="import" href="/settings_page/settings_router.html"> | 9 <link rel="import" href="/settings_page/settings_router.html"> |
| 16 <link rel="import" href="/settings_shared_css.html"> | |
| 17 | 10 |
| 18 <dom-module id="settings-ui"> | 11 <dom-module id="settings-ui"> |
| 19 <template> | 12 <template> |
| 20 <style include="settings-shared"> | 13 <style> |
| 21 :host { | 14 :host { |
| 22 @apply(--layout-fit); | 15 @apply(--layout-fit); |
| 23 -webkit-user-select: none; | 16 -webkit-user-select: none; |
| 24 background-color: var(--settings-background-color); | 17 background-color: var(--settings-background-color); |
| 25 display: flex; | 18 display: flex; |
| 26 flex-direction: column; | 19 flex-direction: column; |
| 27 } | 20 } |
| 28 | 21 |
| 29 paper-drawer-panel { | 22 paper-drawer-panel { |
| 30 --paper-drawer-panel-drawer-container: { | 23 --paper-drawer-panel-drawer-container: { |
| 31 background: none; /* Remove default background styling. */ | 24 background: none; /* Remove default background styling. */ |
| 32 }; | 25 }; |
| 33 align-items: center; | 26 align-items: center; |
| 34 position: relative; | 27 position: relative; |
| 35 } | 28 } |
| 36 | 29 |
| 37 #drawer { | 30 #drawer { |
| 38 --paper-header-panel-shadow: { | 31 --paper-header-panel-shadow: { |
| 39 /* Polymer's style transformation chokes on :host() and :not() (and | 32 /* Polymer's style transformation chokes on :host() and :not() (and |
| 40 * many other things, it seems). Just hide the built-in shadow and | 33 * many other things, it seems). Just hide the built-in shadow and |
| 41 * duplicate its style. */ | 34 * duplicate its style. */ |
| 42 display: none; | 35 display: none; |
| 43 }; | 36 }; |
| 44 /* Explicitly set this so that transitions work and look good. */ | 37 /* Explicitly set this so that transitions work and look good. */ |
| 45 background-color: var(--settings-background-color); | 38 background-color: var(--settings-background-color); |
| 46 } | 39 } |
| 47 | 40 |
| 48 #drawer .toolbar::after { | 41 |
| 49 box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4); | 42 #drawer { |
| 50 content: ''; | 43 transition: background-color 300ms, color 300ms, height 300ms; |
|
michaelpg
2016/06/15 18:01:19
nit: line breaks
| |
| 51 display: block; | |
| 52 height: 6px; | |
| 53 } | 44 } |
| 54 | 45 |
| 55 #drawer, | 46 :host(:not(.narrowing)) [narrow] #drawer { |
| 56 #drawer .toolbar, | |
| 57 #drawer .toolbar::after { | |
| 58 transition: background-color .3s, color .3s, height .3s; | |
| 59 } | |
| 60 | |
| 61 :host(:not(.narrowing)) [narrow] #drawer, | |
| 62 :host(:not(.narrowing)) [narrow] #drawer .toolbar, | |
| 63 :host(:not(.narrowing)) [narrow] #drawer .toolbar::after { | |
| 64 transition: none; /* Transition only when removing [narrow]. */ | 47 transition: none; /* Transition only when removing [narrow]. */ |
| 65 } | 48 } |
| 66 | 49 |
| 67 :host(:not(.narrowing)) [narrow] #drawer, | 50 :host(:not(.narrowing)) [narrow] #drawer { |
| 68 :host(:not(.narrowing)) [narrow] #drawer .toolbar { | |
| 69 background-color: white; | 51 background-color: white; |
| 70 } | 52 } |
| 71 | 53 |
| 72 :host(:not(.narrowing)) [narrow] #drawer .toolbar { | |
| 73 color: var(--settings-nav-grey); | |
| 74 } | |
| 75 | |
| 76 :host(:not(.narrowing)) [narrow] #drawer .toolbar::after { | |
| 77 border-bottom: var(--settings-separator-line); | |
| 78 height: 0; | |
| 79 } | |
| 80 | |
| 81 paper-icon-button { | |
| 82 --iron-icon-fill-color: var(--settings-title-bar-color); | |
| 83 } | |
| 84 | |
| 85 paper-icon-button[suffix] { | |
| 86 --iron-icon-fill-color: var(--settings-title-search-color); | |
| 87 height: 32px; /* After padding, the icon size is 16px. */ | |
| 88 width: 32px; | |
| 89 } | |
| 90 | |
| 91 paper-input { | |
| 92 --paper-input-container: { | |
| 93 padding-top: 0; | |
| 94 }; | |
| 95 --paper-input-container-color: var(--settings-title-search-color); | |
| 96 --paper-input-container-focus-color: var(--settings-title-search-color); | |
| 97 --paper-input-container-input: { | |
| 98 font-size: 81.25%; /* go to 13px from 16px */ | |
| 99 position: relative; | |
| 100 top: 3px; /* Special positioning needed for UX design. */ | |
| 101 }; | |
| 102 | |
| 103 /* | |
| 104 * The button in the input suffix needs special positioning for the UX | |
| 105 * design. The hit box extends right and down from the paper-input | |
| 106 * underline. | |
| 107 */ | |
| 108 --paper-input-suffix: { | |
| 109 left: 8px; | |
| 110 line-height: 16px; | |
| 111 position: relative; | |
| 112 top: 4px; | |
| 113 }; | |
| 114 --paper-input-container-input-color: var(--settings-title-bar-color); | |
| 115 --paper-input-container-label: { | |
| 116 font-size: 81.25%; /* go to 13px from 16px */ | |
| 117 top: 3px; /* Special positioning needed for UX design. */ | |
| 118 }; | |
| 119 --paper-input-max-width: 200px; | |
| 120 | |
| 121 align-items: center; | |
| 122 } | |
| 123 | |
| 124 /* These header elements must create stacking contexts when a section is | |
| 125 * expanding to show a sub-page. (It's simpler for them to always create | |
| 126 * these stacking contexts, so we do.) But for the overlay to work, the | |
| 127 * paper-header-panel's other descendents (rooted at settings-main) must | |
| 128 * never create stacking contexts while a dialog is showing. This means | |
| 129 * we cannot animate a section expanding/collapsing while a dialog is | |
| 130 * shown (which makes good UX sense anyway.) I have discovered a truly | |
| 131 * non-marvellous proof of this, which this comment cannot contain: | |
| 132 * https://goo.gl/CCzijE */ | |
| 133 paper-header-panel[main] paper-toolbar { | |
| 134 z-index: 2; | |
| 135 } | |
| 136 | |
| 137 paper-header-panel[main] { | 54 paper-header-panel[main] { |
| 138 --paper-header-panel-shadow: { | 55 --paper-header-panel-shadow: { |
| 139 z-index: 2; | 56 display: none; |
| 140 }; | 57 }; |
| 141 } | 58 } |
| 142 | 59 |
| 143 /* The paper-drawer-panel implementation gives the drawer a stacking | 60 /* The paper-drawer-panel implementation gives the drawer a stacking |
| 144 * context, so its z-index should at least equal the main panel's. */ | 61 * context, so its z-index should at least equal the main panel's. */ |
| 145 paper-drawer-panel[narrow] { | 62 paper-drawer-panel[narrow] { |
| 146 --paper-drawer-panel-drawer-container: { | 63 --paper-drawer-panel-drawer-container: { |
| 147 z-index: 2; | 64 z-index: 2; |
| 148 }; | 65 }; |
| 149 } | 66 } |
| 150 | 67 |
| 151 paper-toolbar { | 68 cr-toolbar { |
| 152 --paper-toolbar-height: 56px; | 69 --side-bar-width: 256px; |
| 153 --paper-toolbar-sm-height: 56px; | 70 @apply(--layout-center); |
|
michaelpg
2016/06/15 18:01:19
nit: put @apply at top
| |
| 154 --paper-toolbar-content: { | 71 background-color: var(--settings-title-bar-background-color); |
| 155 font-size: 123.08%; /* go to 16px from 13px */ | |
| 156 }; | |
| 157 --paper-toolbar: { | |
| 158 background-color: var(--settings-title-bar-background-color); | |
| 159 }; | |
| 160 } | |
| 161 | |
| 162 /* Prevent paper-toolbar from setting the margin-right to 24px. */ | |
| 163 paper-icon-button#menu-button { | |
| 164 flex-shrink: 0; | |
| 165 /* TODO(dschuyler): this margin is on the right regardless of language | |
| 166 * direction (e.g. rtl). Make a patch for paper-toolbar in Polymer. */ | |
| 167 margin-right: 0; | |
| 168 } | 72 } |
| 169 | 73 |
| 170 .heading { | 74 .heading { |
| 171 -webkit-margin-start: 8px; | 75 -webkit-margin-start: 8px; |
| 172 } | 76 } |
| 173 | 77 |
| 174 paper-drawer-panel:not([narrow]) #main-title { | 78 paper-drawer-panel:not([narrow]) #main-title { |
| 175 display: none; | 79 display: none; |
| 176 } | 80 } |
| 177 | 81 |
| 178 paper-icon-button[toggles]:not([active]) + #search-input { | |
| 179 display: none; | |
| 180 } | |
| 181 | |
| 182 .last { | 82 .last { |
| 183 display: flex; | 83 display: flex; |
| 184 justify-content: flex-end; | 84 justify-content: flex-end; |
| 185 width: 100%; | 85 width: 100%; |
| 186 } | 86 } |
| 187 </style> | 87 </style> |
| 188 <settings-router current-route="{{currentRoute}}" | 88 <settings-router current-route="{{currentRoute}}" |
| 189 current-route-titles="{{currentRouteTitles}}"> | 89 current-route-titles="{{currentRouteTitles}}"> |
| 190 </settings-router> | 90 </settings-router> |
| 91 <cr-toolbar id="main-toolbar" page-name="$i18n{settings}" | |
| 92 clear-label="$i18n{clearSearch}" search-prompt="$i18n{searchPrompt}"> | |
| 93 </cr-toolbar> | |
| 191 <paper-drawer-panel drawer-width="256px" id="panel" narrow="{{isNarrow_}}" | 94 <paper-drawer-panel drawer-width="256px" id="panel" narrow="{{isNarrow_}}" |
| 192 responsive-width="900px"> | 95 responsive-width="900px"> |
| 193 <paper-header-panel drawer id="drawer"> | 96 <paper-header-panel drawer id="drawer"> |
| 194 <paper-toolbar class="toolbar"> | |
| 195 <div class="heading flex">$i18n{settings}</div> | |
| 196 </paper-toolbar> | |
| 197 <settings-menu current-route="{{currentRoute}}"> | 97 <settings-menu current-route="{{currentRoute}}"> |
| 198 </settings-menu> | 98 </settings-menu> |
| 199 </paper-header-panel> | 99 </paper-header-panel> |
| 200 <paper-header-panel main> | 100 <paper-header-panel main> |
| 201 <paper-toolbar class="toolbar"> | |
| 202 <paper-icon-button icon="settings:menu" id="menu-button" | |
| 203 paper-drawer-toggle> | |
| 204 </paper-icon-button> | |
| 205 <div class="heading" id="main-title"> | |
| 206 $i18n{settings} | |
| 207 </div> | |
| 208 <div class="last"> | |
| 209 <paper-icon-button icon="cr:search" toggles> | |
| 210 </paper-icon-button> | |
| 211 <paper-input id="search-input" label="$i18n{internalSearch}" | |
| 212 no-label-float> | |
| 213 <!-- TODO(dschuyler): implement internal search. --> | |
| 214 <paper-icon-button suffix icon="cr:cancel"> | |
| 215 </paper-icon-button> | |
| 216 </paper-input> | |
| 217 </div> | |
| 218 </paper-toolbar> | |
| 219 <settings-main prefs="{{prefs}}" current-route="{{currentRoute}}"> | 101 <settings-main prefs="{{prefs}}" current-route="{{currentRoute}}"> |
| 220 </settings-main> | 102 </settings-main> |
| 221 </paper-header-panel> | 103 </paper-header-panel> |
| 222 </paper-drawer-panel> | 104 </paper-drawer-panel> |
| 223 </template> | 105 </template> |
| 224 <script src="settings_ui.js"></script> | 106 <script src="settings_ui.js"></script> |
| 225 </dom-module> | 107 </dom-module> |
| OLD | NEW |