From 98d32c69ca79ff20e4933b8f4626a5616f62c2c5 Mon Sep 17 00:00:00 2001 From: mkrds Date: Tue, 22 Jun 2021 11:40:53 +0200 Subject: [PATCH] feat(button-toggle): enhance button toggle visuals Enhance ButtonToggle visuals and add new size prop --- cypress/fixtures/themes/themes.json | 6 +- .../button-toggle-group.spec.js.snap | 31 +- .../__snapshots__/button-toggle.spec.js.snap | 107 ++++--- .../button-toggle/button-toggle.component.js | 15 +- .../button-toggle/button-toggle.d.ts | 2 + .../button-toggle/button-toggle.spec.js | 81 ++++- .../button-toggle/button-toggle.stories.mdx | 303 +++++++++++++----- .../button-toggle/button-toggle.style.js | 73 ++++- 8 files changed, 439 insertions(+), 179 deletions(-) diff --git a/cypress/fixtures/themes/themes.json b/cypress/fixtures/themes/themes.json index 48e025421c..3af841f70b 100644 --- a/cypress/fixtures/themes/themes.json +++ b/cypress/fixtures/themes/themes.json @@ -1,8 +1,8 @@ { "button-toggle": { - "mint": "rgb(0, 64, 46)", - "aegean": "rgb(0, 68, 114)", - "none": "rgb(0, 69, 0)" + "mint": "rgb(230, 246, 241)", + "aegean": "rgb(230, 241, 250)", + "none": "rgb(230, 245, 230)" }, "common": { "mint": "rgb(0, 129, 93)", diff --git a/src/components/button-toggle-group/__snapshots__/button-toggle-group.spec.js.snap b/src/components/button-toggle-group/__snapshots__/button-toggle-group.spec.js.snap index 90fe29c3ce..e75eb498df 100644 --- a/src/components/button-toggle-group/__snapshots__/button-toggle-group.spec.js.snap +++ b/src/components/button-toggle-group/__snapshots__/button-toggle-group.spec.js.snap @@ -21,22 +21,24 @@ exports[`ButtonToggleGroup Modern theme renders correctly with default settings .c6 { display: inline-block; position: relative; - height: 38px; + box-sizing: border-box; + height: 40px; padding: 0 24px; + font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid #668592; - font-size: 14px; background-color: #FFFFFF; } -input:checked ~ .c6 { - color: #FFFFFF; - background-color: #00402E; +.c6 .c8 { + color: #000000; } -input:checked ~ .c6 .c8 { - color: #FFFFFF; +input:checked ~ .c6.c6 { + background-color: #E6F6F1; + border-color: #006046; + cursor: auto; } input:focus ~ .c6 { @@ -44,9 +46,14 @@ input:focus ~ .c6 { z-index: 100; } -.c6:hover { - background-color: #E6F6F1; - border-color: #00402E; +input:not(:checked) ~ .c6:hover { + background-color: #006046; + border-color: #006046; + color: #FFFFFF; +} + +input:not(:checked) ~ .c6:hover .c8 { + color: #FFFFFF; } .c4 { @@ -55,7 +62,7 @@ input:focus ~ .c6 { } .c4:not(:first-of-type) { - margin-left: 10px; + margin-left: 8px; } .c5 { @@ -116,6 +123,7 @@ input:focus ~ .c6 { htmlFor="guid-12345" onMouseEnter={[Function]} onMouseLeave={[Function]} + size="medium" >
Button
@@ -248,22 +265,24 @@ exports[`ButtonToggle when the mint theme is set renders correct styles 1`] = ` .c2 { display: inline-block; position: relative; - height: 38px; + box-sizing: border-box; + height: 40px; padding: 0 24px; + font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid #668592; - font-size: 14px; background-color: #FFFFFF; } -input:checked ~ .c2 { - color: #FFFFFF; - background-color: #00402E; +.c2 .c4 { + color: #000000; } -input:checked ~ .c2 .c4 { - color: #FFFFFF; +input:checked ~ .c2.c2 { + background-color: #E6F6F1; + border-color: #006046; + cursor: auto; } input:focus ~ .c2 { @@ -271,9 +290,14 @@ input:focus ~ .c2 { z-index: 100; } -.c2:hover { - background-color: #E6F6F1; - border-color: #00402E; +input:not(:checked) ~ .c2:hover { + background-color: #006046; + border-color: #006046; + color: #FFFFFF; +} + +input:not(:checked) ~ .c2:hover .c4 { + color: #FFFFFF; } .c0 { @@ -282,7 +306,7 @@ input:focus ~ .c2 { } .c0:not(:first-of-type) { - margin-left: 10px; + margin-left: 8px; } .c1 { @@ -307,6 +331,7 @@ input:focus ~ .c2 {