Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: css/io-toggle.scss

Issue 29730644: Issue 6514 - IOToggle Custom Element (Closed)
Patch Set: Created March 26, 2018, 2:24 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: css/io-toggle.scss
===================================================================
new file mode 100644
--- /dev/null
+++ b/css/io-toggle.scss
@@ -0,0 +1,74 @@
+io-toggle {
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
+ --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
+ --height: 8px;
+ --translateY: -4px;
+ --translateX: 14px;
+ display: inline-block;
+ width: var(--width);
+ height: var(--height);
+ border-radius: 4px;
+ 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
+ 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
+ will-change: background;
+ cursor: pointer;
+}
+
+io-toggle[checked] {
+ 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.
+}
+
+io-toggle[disabled] {
+ opacity: 0.5;
+ cursor: default;
+}
+
+io-toggle button {
+ width: calc(var(--height) * 2);
+ height: calc(var(--height) * 2);
+ padding: 0;
+ border: 2px solid #e1e0e1;
+ border-radius: var(--height);
+ transition: border .2s ease-out, box-shadow .2s ease-out,
+ transform .2s ease-out, width .2s ease-out;
+ will-change: border, box-shadow, transform, width;
+ transform: translateY(var(--translateY));
+ outline: none;
+ cursor: pointer;
+}
+
+io-toggle button[aria-checked="false"]
+{
+ background-color: #f1f1f1;
+ box-shadow: 0 1px 2px 0 #e5d1d1;
+}
+
+io-toggle button[aria-checked="false"]:hover
+{
+ box-shadow: 0 2px 4px 0 #d3b0b0;
+}
+
+io-toggle button[aria-checked="true"]
+{
+ background-color: #059cd0;
+ border: 2px solid #059cd0;
+ box-shadow: 0 1px 2px 0 #a6cede;
+ transform: translateY(var(--translateY)) translateX(var(--translateX));
+}
+
+io-toggle button[aria-checked="true"]:hover
+{
+ box-shadow: 0 2px 4px 0 #a6cede;
+}
+
+io-toggle button:focus,
+io-toggle button[aria-checked="true"]:focus
+{
+ border: 2px solid #87bffe;
+}
+
+/* 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.
+body[dir="rtl"] io-toggle button[aria-checked="true"]
+{
+ transform: translateY(var(--translateY)) translateX(calc(var(--translateX) * -1));
+}
+//*/

Powered by Google App Engine
This is Rietveld