 Issue 29730644:
  Issue 6514 - IOToggle Custom Element  (Closed)
    
  
    Issue 29730644:
  Issue 6514 - IOToggle Custom Element  (Closed) 
  | Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 io-toggle { | 1 /* | 
| 
Thomas Greiner
2018/04/25 17:29:14
Coding style: "Opening braces always go on their o
 
a.giammarchi
2018/04/26 10:44:51
have we published this eyeo style thing somewhere
 
Thomas Greiner
2018/04/26 17:00:52
Yep, two weeks ago we've published the stylelint-c
 | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-present eyeo GmbH | |
| 4 * | |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License version 3 as | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 io-toggle | |
| 19 { | |
| 2 --width: 30px; | 20 --width: 30px; | 
| 
saroyanm
2018/04/25 17:05:01
While we are using SASS, wouldn't that make more s
 
a.giammarchi
2018/04/26 10:44:51
I think the whole point of dropping Edge 14 was to
 
Thomas Greiner
2018/04/26 17:00:51
I'd argue that we want to rely on web standards as
 
a.giammarchi
2018/04/27 10:59:04
this doesn't address the fact CSS variables are al
 
Thomas Greiner
2018/05/02 11:53:28
That's also what I'm saying that we should always
 | |
| 3 --height: 8px; | 21 --height: 8px; | 
| 4 --translateY: -4px; | 22 --translateY: -4px; | 
| 5 --translateX: 14px; | 23 --translateX: 14px; | 
| 6 display: inline-block; | 24 display: inline-block; | 
| 7 width: var(--width); | 25 width: var(--width); | 
| 8 height: var(--height); | 26 height: var(--height); | 
| 9 border-radius: 4px; | 27 border-radius: 4px; | 
| 10 background-color: #9b9b9b; | 28 background-color: #9b9b9b; | 
| 
saroyanm
2018/04/25 17:05:01
Having colors set separately will make it easy to
 
a.giammarchi
2018/04/26 10:44:51
Yeah. Colors might be one of those immutable share
 | |
| 11 transition: background .2s ease-out; | 29 transition: background .2s ease-out; | 
| 
Thomas Greiner
2018/04/25 17:29:13
Technically, we only expect "background-color" to
 
Thomas Greiner
2018/04/25 17:29:13
Coding style: "Don't omit the optional leading 0 f
 
a.giammarchi
2018/04/26 10:44:51
AFAIK that doesn't work. will change wants backgro
 
Thomas Greiner
2018/04/26 17:00:51
Interesting. I wasn't aware of that. No problem wi
 | |
| 12 will-change: background; | 30 will-change: background; | 
| 13 cursor: pointer; | 31 cursor: pointer; | 
| 14 } | 32 } | 
| 15 | 33 | 
| 16 io-toggle[checked] { | 34 io-toggle[checked] | 
| 35 { | |
| 17 background-color: #92d3ea; | 36 background-color: #92d3ea; | 
| 
Thomas Greiner
2018/04/25 17:29:13
How did you choose the colors? At least this one i
 
a.giammarchi
2018/04/26 10:44:51
I have downloaded specs images and picked color th
 
Thomas Greiner
2018/04/26 17:00:51
Since the part of the spec I referred to only appl
 
a.giammarchi
2018/04/27 10:59:04
AFAIK Jeen already approved this component and wan
 
Thomas Greiner
2018/05/02 11:53:27
Acknowledged.
 | |
| 18 } | 37 } | 
| 19 | 38 | 
| 20 io-toggle[disabled] { | 39 io-toggle[disabled] | 
| 40 { | |
| 21 opacity: 0.5; | 41 opacity: 0.5; | 
| 22 cursor: default; | 42 cursor: default; | 
| 23 } | 43 } | 
| 24 | 44 | 
| 25 io-toggle button { | 45 io-toggle button | 
| 46 { | |
| 26 width: calc(var(--height) * 2); | 47 width: calc(var(--height) * 2); | 
| 27 height: calc(var(--height) * 2); | 48 height: calc(var(--height) * 2); | 
| 28 padding: 0; | 49 padding: 0; | 
| 29 border: 2px solid #e1e0e1; | 50 border: 2px solid #e1e0e1; | 
| 30 border-radius: var(--height); | 51 border-radius: var(--height); | 
| 31 transition: border .2s ease-out, box-shadow .2s ease-out, | 52 transition: border .2s ease-out, box-shadow .2s ease-out, | 
| 32 transform .2s ease-out, width .2s ease-out; | 53 transform .2s ease-out, width .2s ease-out; | 
| 33 will-change: border, box-shadow, transform, width; | 54 will-change: border, box-shadow, transform, width; | 
| 34 transform: translateY(var(--translateY)); | 55 transform: translateY(var(--translateY)); | 
| 35 outline: none; | 56 outline: none; | 
| (...skipping 23 matching lines...) Expand all Loading... | |
| 59 { | 80 { | 
| 60 box-shadow: 0 2px 4px 0 #a6cede; | 81 box-shadow: 0 2px 4px 0 #a6cede; | 
| 61 } | 82 } | 
| 62 | 83 | 
| 63 io-toggle button:focus, | 84 io-toggle button:focus, | 
| 64 io-toggle button[aria-checked="true"]:focus | 85 io-toggle button[aria-checked="true"]:focus | 
| 65 { | 86 { | 
| 66 border: 2px solid #87bffe; | 87 border: 2px solid #87bffe; | 
| 67 } | 88 } | 
| 68 | 89 | 
| 69 /* in case we will need to switch active/disabled direction | |
| 
Thomas Greiner
2018/04/25 17:29:13
I was also wondering about that and it appears tha
 
a.giammarchi
2018/04/26 10:44:50
it took me a little while to figure this out, so I
 
Thomas Greiner
2018/04/26 17:00:52
For some reason I thought you were talking about t
 
a.giammarchi
2018/04/27 10:59:04
I'll double check with Jeen before eventually remo
 
Thomas Greiner
2018/05/02 11:53:27
Acknowledged.
 | |
| 70 body[dir="rtl"] io-toggle button[aria-checked="true"] | 90 body[dir="rtl"] io-toggle button[aria-checked="true"] | 
| 71 { | 91 { | 
| 72 transform: translateY(var(--translateY)) translateX(calc(var(--translateX) * - 1)); | 92 transform: translateY(var(--translateY)) translateX(calc(var(--translateX) * - 1)); | 
| 73 } | 93 } | 
| 74 //*/ | |
| LEFT | RIGHT |