Commit 9d324d47 authored by dpapad's avatar dpapad Committed by Commit bot

MD Settings: Style native <select> down arrow.

BUG=651513
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2384273005
Cr-Commit-Position: refs/heads/master@{#423009}
parent b711bbea
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
<dom-module id="settings-dropdown-menu"> <dom-module id="settings-dropdown-menu">
<template> <template>
<style include="settings-shared md-select"></style> <style include="settings-shared md-select"></style>
<div class="select-wrapper"> <div class="md-select-wrapper">
<select id="dropdownMenu" on-change="onChange_" value="[[selected_]]" <select class="md-select" id="dropdownMenu" on-change="onChange_"
value="[[selected_]]"
disabled="[[shouldDisableMenu_(disabled, menuOptions)]]"> disabled="[[shouldDisableMenu_(disabled, menuOptions)]]">
<template is="dom-repeat" items="[[menuOptions]]"> <template is="dom-repeat" items="[[menuOptions]]">
<option value="[[item.value]]" data-value$="[[item.value]]"> <option value="[[item.value]]" data-value$="[[item.value]]">
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
$i18n{custom} $i18n{custom}
</option> </option>
</select> </select>
<span class="select-underline"></span> <span class="md-select-underline"></span>
</div> </div>
</template> </template>
<script src="settings_dropdown_menu.js"></script> <script src="settings_dropdown_menu.js"></script>
......
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#757575"><g><path d="M 0 0 L 24 0 L 12 12 z"/></g></svg>
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
<dom-module id="md-select"> <dom-module id="md-select">
<template> <template>
<style> <style>
select { .md-select {
background-color: transparent; -webkit-appearance: none;
background: url(images/arrow_down.svg) 97% 70% no-repeat;
background-size: 0.9em;
border-bottom: 1px solid var(--paper-grey-300); border-bottom: 1px solid var(--paper-grey-300);
border-left: none; border-left: none;
border-right: none; border-right: none;
...@@ -18,7 +20,11 @@ ...@@ -18,7 +20,11 @@
width: 200px; width: 200px;
} }
.select-underline { :host-context([dir=rtl]) .md-select {
background-position-x: 3%;
}
.md-select-underline {
border-top: 2px solid var(--paper-indigo-500); border-top: 2px solid var(--paper-indigo-500);
display: block; display: block;
position: relative; position: relative;
...@@ -28,12 +34,12 @@ ...@@ -28,12 +34,12 @@
width: 100%; width: 100%;
} }
select:focus + .select-underline { .md-select:focus + .md-select-underline {
transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1);
transition: transform 200ms ease-out; transition: transform 200ms ease-out;
} }
.select-wrapper { .md-select-wrapper {
display: inline-block; display: inline-block;
} }
</style> </style>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
width: calc((var(--paper-input-max-width) - 16px) / 2); width: calc((var(--paper-input-max-width) - 16px) / 2);
} }
select.address-column { .md-select.address-column {
-webkit-margin-end: 0; -webkit-margin-end: 0;
margin-bottom: 0; margin-bottom: 0;
} }
...@@ -75,9 +75,9 @@ ...@@ -75,9 +75,9 @@
</template> </template>
<div id="select-row" class="address-row"> <div id="select-row" class="address-row">
<div id="select-label">$i18n{addressCountry}</div> <div id="select-label">$i18n{addressCountry}</div>
<span class="select-wrapper"> <span class="md-select-wrapper">
<select class="address-column long" value="[[countryCode_]]" <select class="md-select address-column long"
on-change="onCountryChange_"> value="[[countryCode_]]" on-change="onCountryChange_">
<option value=""></option> <option value=""></option>
<template is="dom-repeat" items="[[countries_]]"> <template is="dom-repeat" items="[[countries_]]">
<option value="[[getCode_(item)]]" <option value="[[getCode_(item)]]"
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
</option> </option>
</template> </template>
</select> </select>
<span class="select-underline"></span> <span class="md-select-underline"></span>
</span> </span>
</div> </div>
<div class="address-row"> <div class="address-row">
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
width: var(--paper-input-max-width); width: var(--paper-input-max-width);
} }
.select-wrapper + .select-wrapper { .md-select-wrapper + .md-select-wrapper {
-webkit-margin-start: 16px; -webkit-margin-start: 16px;
} }
...@@ -40,23 +40,23 @@ ...@@ -40,23 +40,23 @@
value="{{creditCard.cardNumber}}" always-float-label> value="{{creditCard.cardNumber}}" always-float-label>
</paper-input> </paper-input>
<label>$i18n{creditCardExpiration}</label> <label>$i18n{creditCardExpiration}</label>
<span class="select-wrapper"> <span class="md-select-wrapper">
<select id="month" value="[[expirationMonth_]]" <select class="md-select" id="month" value="[[expirationMonth_]]"
on-change="onMonthChange_"> on-change="onMonthChange_">
<template is="dom-repeat" items="[[monthList_]]"> <template is="dom-repeat" items="[[monthList_]]">
<option>[[item]]</option> <option>[[item]]</option>
</template> </template>
</select> </select>
<span class="select-underline"></span> <span class="md-select-underline"></span>
</span> </span>
<span class="select-wrapper"> <span class="md-select-wrapper">
<select id="year" value="[[expirationYear_]]" <select class="md-select" id="year" value="[[expirationYear_]]"
on-change="onYearChange_"> on-change="onYearChange_">
<template is="dom-repeat" items="[[yearList_]]"> <template is="dom-repeat" items="[[yearList_]]">
<option>[[item]]</option> <option>[[item]]</option>
</template> </template>
</select> </select>
<span class="select-underline"></span> <span class="md-select-underline"></span>
</span> </span>
</div> </div>
<div class="button-container"> <div class="button-container">
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
<div class="settings-box first"> <div class="settings-box first">
<p class="start">$i18n{searchExplanation}</p> <p class="start">$i18n{searchExplanation}</p>
<div> <div>
<select on-change="onChange_"> <select class="md-select" on-change="onChange_">
<template is="dom-repeat" items="[[searchEngines_]]"> <template is="dom-repeat" items="[[searchEngines_]]">
<option selected$="[[item.default]]">[[item.name]]</option> <option selected$="[[item.default]]">[[item.name]]</option>
</template> </template>
</select> </select>
<span class="select-underline"></span> <span class="md-select-underline"></span>
</div> </div>
</div> </div>
<div id="subpage-trigger" class="settings-box two-line" <div id="subpage-trigger" class="settings-box two-line"
......
...@@ -235,7 +235,8 @@ ...@@ -235,7 +235,8 @@
flattenhtml="true" /> flattenhtml="true" />
<structure name="IDR_SETTINGS_MD_SELECT_CSS_HTML" <structure name="IDR_SETTINGS_MD_SELECT_CSS_HTML"
file="md_select_css.html" file="md_select_css.html"
type="chrome_html" /> type="chrome_html"
flattenhtml="true" />
<structure name="IDR_SETTINGS_CR_SETTINGS_UI_HTML" <structure name="IDR_SETTINGS_CR_SETTINGS_UI_HTML"
file="settings_ui/settings_ui.html" file="settings_ui/settings_ui.html"
type="chrome_html" /> type="chrome_html" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment