Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_searc h_field_behavior.html"> | |
| 2 <link rel="import" href="chrome://resources/cr_elements/icons.html"> | |
| 3 <link rel="import" href="chrome://resources/html/polymer.html"> | |
| 4 <link rel="import" href="chrome://resources/polymer/v1_0/iron-input/iron-input.h tml"> | |
| 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 -container.html"> | |
| 7 <link rel="stylesheet" href="chrome://resources/css/md_colors.css"> | |
| 8 | |
| 9 <dom-module id="cr-toolbar"> | |
| 10 <template> | |
| 11 <style no-process> | |
| 12 :host { | |
| 13 background-color: var(--md-toolbar-color); | |
| 14 } | |
| 15 </style> | |
| 16 <style> | |
| 17 :host { | |
| 18 color: #fff; | |
| 19 display: flex; | |
| 20 height: 56px; | |
| 21 } | |
| 22 | |
| 23 [hidden] { | |
| 24 display: none !important; | |
| 25 } | |
| 26 | |
| 27 paper-icon-button { | |
| 28 --paper-icon-button: { | |
|
calamity
2016/05/16 04:27:34
QQ: Why is this applied as a mixin? So that will o
tsergeant
2016/05/17 03:24:39
That's a cargo-cult from PDF which is...not necess
| |
| 29 height: 32px; | |
| 30 padding: 6px; | |
| 31 width: 32px; | |
| 32 }; | |
| 33 margin: 6px; | |
| 34 } | |
| 35 | |
| 36 h1 { | |
| 37 @apply(--layout-flex); | |
| 38 -webkit-padding-start: 24px; | |
| 39 font-size: 123%; | |
| 40 font-weight: 400; | |
| 41 } | |
| 42 | |
| 43 #left-content { | |
| 44 align-items: center; | |
| 45 display: flex; | |
| 46 flex: 1 0 var(--side-bar-width, 0); | |
| 47 } | |
| 48 | |
| 49 #centered-content { | |
| 50 -webkit-padding-end: 12px; | |
| 51 display: flex; | |
| 52 flex: 0 1 var(--content-max-width, 960px); | |
| 53 justify-content: center; | |
| 54 } | |
| 55 | |
| 56 #right-padding { | |
| 57 flex: 1 0 0; | |
| 58 } | |
| 59 | |
| 60 #search-field { | |
| 61 align-items: center; | |
| 62 display: flex; | |
| 63 height: 40px; | |
| 64 transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), | |
| 65 width 150ms cubic-bezier(0.4, 0, 0.2, 1); | |
| 66 } | |
| 67 | |
| 68 #search-prompt { | |
| 69 display: none; | |
|
calamity
2016/05/16 04:27:34
Some animation jank can happen here from text wrap
tsergeant
2016/05/17 03:24:39
Done.
| |
| 70 } | |
| 71 | |
| 72 #search-container { | |
| 73 --paper-input-container-input-color: white; | |
| 74 --paper-input-container-underline: { | |
| 75 display: none; | |
| 76 }; | |
| 77 --paper-input-container-underline-focus: { | |
| 78 display: none; | |
| 79 }; | |
| 80 -webkit-padding-start: 2px; | |
| 81 flex: 1; | |
| 82 } | |
| 83 | |
| 84 input[type='search']::-webkit-search-decoration, | |
| 85 input[type='search']::-webkit-search-cancel-button, | |
| 86 input[type='search']::-webkit-search-results-button { | |
| 87 -webkit-appearance: none; | |
| 88 } | |
| 89 | |
| 90 /** Thin layout, no search open. */ | |
| 91 @media(max-width: 900px) { | |
| 92 #centered-content { | |
| 93 justify-content: flex-end; | |
| 94 } | |
| 95 | |
| 96 #search-field { | |
| 97 width: 44px; | |
| 98 } | |
| 99 } | |
| 100 | |
| 101 /** Wide layout, no search open. */ | |
| 102 @media(min-width: 900px) { | |
| 103 :host(:not([showing-search_])) #search-field { | |
| 104 -webkit-padding-end: 0; | |
| 105 background: rgba(0, 0, 0, 0.22); | |
| 106 border-radius: 2px; | |
| 107 cursor: text; | |
| 108 width: 580px; | |
| 109 } | |
| 110 | |
| 111 :host(:not([showing-search_])) #search-icon, | |
| 112 :host(:not([showing-search_])) #search-prompt { | |
| 113 display: inline; | |
| 114 opacity: 0.6; | |
| 115 } | |
| 116 } | |
| 117 | |
| 118 /* Any layout, search open. */ | |
| 119 :host([showing-search_]) #search-field { | |
| 120 width: 100%; | |
| 121 } | |
| 122 | |
| 123 :host([showing-search_]) #right-padding { | |
| 124 display: none; | |
| 125 } | |
| 126 | |
| 127 :host([showing-search_]) #centered-content { | |
| 128 flex-grow: 1; | |
|
calamity
2016/05/16 04:27:34
As discussed, this is causing animation jank becau
tsergeant
2016/05/17 03:24:39
Done.
| |
| 129 } | |
| 130 | |
| 131 :host([showing-search_]) #left-content { | |
| 132 flex-grow: 0; | |
| 133 } | |
| 134 | |
| 135 /* Thin layout, search open. */ | |
| 136 @media(max-width: 900px) { | |
| 137 :host([showing-search_]) #left-content { | |
| 138 display: none; | |
| 139 } | |
| 140 | |
| 141 :host([showing-search_]) #search-icon { | |
| 142 margin-left: 18px; | |
| 143 } | |
| 144 } | |
| 145 </style> | |
| 146 <div id="left-content"> | |
| 147 <h1>[[pageName]]</h1> | |
| 148 </div> | |
| 149 | |
| 150 <div id="centered-content"> | |
| 151 <div id="search-field" on-click="showSearch_"> | |
| 152 <paper-icon-button id="search-icon" icon="search"></paper-icon-button> | |
| 153 <span id="search-prompt">Search [[lowerPageName_]]</span> | |
|
calamity
2016/05/16 04:27:34
It would seem that in i18n, the rule is "Do it dum
tsergeant
2016/05/17 03:24:39
Done, and I've added back in clearLabel as well.
| |
| 154 <paper-input-container id="search-container" on-search="onSearchTermSear ch_" | |
| 155 on-keydown="onSearchTermKeydown_" hidden$="[[!showingSearch_]]" | |
| 156 no-label-float> | |
| 157 <input is="iron-input" id="search-input" type="search" | |
| 158 incremental></input> | |
| 159 </paper-input-container> | |
| 160 <paper-icon-button icon="cancel" id="clear-search" | |
| 161 on-click="toggleShowingSearch_" title="[[clearLabel]]" | |
| 162 hidden$="[[!hasSearchText_]]"> | |
| 163 </paper-icon-button> | |
| 164 </div> | |
| 165 </div> | |
| 166 | |
| 167 <div id="right-padding"></div> | |
|
calamity
2016/05/16 04:27:34
I think we can get rid of this right-padding div a
tsergeant
2016/05/17 03:24:39
Done.
| |
| 168 </template> | |
| 169 <script src="cr_toolbar.js"></script> | |
| 170 </dom-module> | |
| OLD | NEW |