From 77692857a437b9001c01c2be682611f86c89f2d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20B=C3=A4r?= Date: Thu, 4 Jun 2020 16:11:09 +0200 Subject: [PATCH] feat(components): polish Button components (#605) * feat(components): revert default Button variant to secondary The previous default Button style matches the new secondary variant most, so to avoid a breaking change, I've made it the default variant. * feat(components): use IconButton for Carousel buttons * feat(components): change Hamburger default size to match IconButton * feat(components): remove Button giga size To our knowledge, this size was never used. In order to reduce the API surface, we're removing it. * feat(components): tweak Button border radius * test(components): update snapshots * fix(components): fix small icons for Carousel buttons BREAKING CHANGE: The Button's `giga` size has been removed. Use the `mega` size (default) instead. --- scripts/static-styles/config.js | 2 +- src/__snapshots__/storyshots.spec.js.snap | 1221 +++++++++-------- src/components/Button/Button.docs.mdx | 3 +- src/components/Button/Button.spec.tsx | 5 - src/components/Button/Button.story.tsx | 5 +- src/components/Button/Button.tsx | 24 +- .../Button/__snapshots__/Button.spec.tsx.snap | 169 +-- .../__snapshots__/Carousel.spec.js.snap | 850 ++++++------ .../Carousel/components/Buttons/Buttons.js | 57 +- .../__snapshots__/Buttons.spec.js.snap | 247 ++-- src/components/CloseButton/CloseButton.js | 2 +- .../__snapshots__/CloseButton.spec.js.snap | 4 +- src/components/Hamburger/Hamburger.tsx | 7 +- .../__snapshots__/Hamburger.spec.tsx.snap | 8 +- src/components/Header/Header.story.js | 2 +- .../IconButton/IconButton.story.tsx | 2 +- src/components/IconButton/IconButton.tsx | 3 +- .../__snapshots__/IconButton.spec.tsx.snap | 16 +- .../LoadingButton/LoadingButton.story.tsx | 2 +- .../__snapshots__/LoadingButton.spec.tsx.snap | 32 +- .../Pagination/PageButton/PageButton.js | 2 +- .../__snapshots__/PageButton.spec.js.snap | 23 +- .../PaginationButton.spec.js.snap | 4 +- .../PaginationContainer.spec.js.snap | 96 +- .../__snapshots__/Pagination.spec.js.snap | 353 +++-- src/components/SearchInput/SearchInput.js | 1 - .../__snapshots__/Sidebar.spec.js.snap | 8 +- .../__snapshots__/CloseButton.spec.js.snap | 8 +- .../Tag/__snapshots__/Tag.spec.js.snap | 2 +- yarn.lock | 6 +- 30 files changed, 1468 insertions(+), 1696 deletions(-) diff --git a/scripts/static-styles/config.js b/scripts/static-styles/config.js index fe1aa8eafa..efb31f43bd 100644 --- a/scripts/static-styles/config.js +++ b/scripts/static-styles/config.js @@ -128,7 +128,7 @@ export default { } }, // TODO: Make React DocGen work with TypeScript - // getComponentInfo(Button, { size: [KILO, MEGA, GIGA] }), + // getComponentInfo(Button, { size: [KILO, MEGA] }), getComponentInfo(Blockquote, { size: [Blockquote.KILO, Blockquote.MEGA, Blockquote.GIGA] }), diff --git a/src/__snapshots__/storyshots.spec.js.snap b/src/__snapshots__/storyshots.spec.js.snap index 3c7d83a2e6..d65dd581b1 100644 --- a/src/__snapshots__/storyshots.spec.js.snap +++ b/src/__snapshots__/storyshots.spec.js.snap @@ -298,7 +298,6 @@ exports[`Storyshots Components/Button Primary 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -307,6 +306,7 @@ exports[`Storyshots Components/Button Primary 1`] = ` border-color: #3388FF; color: #FFFFFF; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -365,7 +365,6 @@ exports[`Storyshots Components/Button Secondary 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -374,6 +373,7 @@ exports[`Storyshots Components/Button Secondary 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -399,7 +399,7 @@ exports[`Storyshots Components/Button Secondary 1`] = ` .circuit-0:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } , - .circuit-0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - width: auto; - height: auto; - cursor: pointer; - font-size: 16px; - line-height: 24px; - text-align: center; - -webkit-text-decoration: none; - text-decoration: none; - font-weight: 700; - border-radius: 5px; - border-width: 1px; - border-style: solid; - -webkit-transition: opacity 200ms ease-in-out; - transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; - padding: 12px calc(32px - 1px); -} - -.circuit-0:focus { - outline: 0; - box-shadow: 0 0 0 4px #AFD0FE; -} - -.circuit-0:focus::-moz-focus-inner { - border: 0; -} - -.circuit-0:disabled, -.circuit-0[disabled] { - opacity: 0.5; - pointer-events: none; - box-shadow: none; -} - -.circuit-0:hover { - background-color: #1760CE; - border-color: #1760CE; -} - -.circuit-0:active { - background-color: #003C8B; - border-color: #003C8B; -} - -, ] `; @@ -629,7 +565,6 @@ exports[`Storyshots Components/Button Tertiary 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -638,6 +573,7 @@ exports[`Storyshots Components/Button Tertiary 1`] = ` border-color: transparent; color: #3388FF; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -694,7 +630,6 @@ exports[`Storyshots Components/Button With Icon 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -703,6 +638,7 @@ exports[`Storyshots Components/Button With Icon 1`] = ` border-color: #3388FF; color: #FFFFFF; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -778,7 +714,6 @@ exports[`Storyshots Components/Button/ButtonGroup Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -787,6 +722,7 @@ exports[`Storyshots Components/Button/ButtonGroup Base 1`] = ` border-color: #3388FF; color: #FFFFFF; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-1:focus { @@ -837,7 +773,6 @@ exports[`Storyshots Components/Button/ButtonGroup Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -846,6 +781,7 @@ exports[`Storyshots Components/Button/ButtonGroup Base 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -871,7 +807,7 @@ exports[`Storyshots Components/Button/ButtonGroup Base 1`] = ` .circuit-0:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-2 { @@ -951,7 +887,6 @@ exports[`Storyshots Components/Button/CloseButton Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -960,6 +895,7 @@ exports[`Storyshots Components/Button/CloseButton Base 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; } @@ -986,7 +922,7 @@ exports[`Storyshots Components/Button/CloseButton Base 1`] = ` .circuit-1:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-0 { @@ -1052,7 +988,6 @@ exports[`Storyshots Components/Button/IconButton Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -1061,6 +996,7 @@ exports[`Storyshots Components/Button/IconButton Base 1`] = ` border-color: #3388FF; color: #FFFFFF; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-1:focus { @@ -1180,7 +1116,6 @@ exports[`Storyshots Components/Button/LoadingButton Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -1189,6 +1124,7 @@ exports[`Storyshots Components/Button/LoadingButton Base 1`] = ` border-color: #3388FF; color: #FFFFFF; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-3:focus { @@ -4099,15 +4035,15 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-1:focus { @@ -4127,13 +4063,13 @@ HTMLCollection [ } .circuit-1:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-1:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } .circuit-3 { @@ -4291,15 +4227,15 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-1:focus { @@ -4319,13 +4255,13 @@ HTMLCollection [ } .circuit-1:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-1:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } .circuit-7 { @@ -4636,7 +4572,6 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -4645,6 +4580,7 @@ HTMLCollection [ border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; } @@ -4671,7 +4607,7 @@ HTMLCollection [ .circuit-2:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-1 { @@ -4856,7 +4792,20 @@ exports[`Storyshots Components/Card/CardList Base 1`] = ` `; exports[`Storyshots Components/Carousel Composed 1`] = ` -.circuit-52 { +.circuit-38 { + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +.circuit-50 { width: 100%; height: auto; position: relative; @@ -4969,7 +4918,7 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` z-index: -2; } -.circuit-50 { +.circuit-48 { width: 100%; display: -webkit-box; display: -webkit-flex; @@ -4986,7 +4935,7 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` margin-top: 16px; } -.circuit-41 { +.circuit-40 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5008,86 +4957,48 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-41:focus { +.circuit-40:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-41:focus::-moz-focus-inner { +.circuit-40:focus::-moz-focus-inner { border: 0; } -.circuit-41:disabled, -.circuit-41[disabled] { +.circuit-40:disabled, +.circuit-40[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-41:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-40:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-41:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-40:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-41:first-of-type { +.circuit-40:first-of-type { margin-left: 0; } -.circuit-41:active, -.circuit-41:focus, -.circuit-41:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-41 { - width: 24px; - height: 24px; - } - - .circuit-41 svg { - width: 25%; - } -} - -.circuit-38 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - .circuit-8 { box-shadow: 0 0 1px rgba(0,0,0,0.05); overflow: hidden; @@ -5106,7 +5017,7 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` background: #FAFBFC; } -.circuit-48 { +.circuit-46 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5121,7 +5032,7 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` justify-content: center; } -.circuit-42 { +.circuit-41 { font-weight: 400; margin-bottom: 16px; font-size: 16px; @@ -5131,14 +5042,14 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` } @media (min-width:480px) { - .circuit-42 { + .circuit-41 { font-size: 16px; line-height: 24px; } } @media (max-width:479px) { - .circuit-42 { + .circuit-41 { font-size: 13px; line-height: 20px; } @@ -5148,7 +5059,7 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` style="width: 50vw;" >

1 @@ -5265,28 +5178,30 @@ exports[`Storyshots Components/Carousel Composed 1`] = ` 3

@@ -5318,16 +5233,29 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` } } -.circuit-61 { - width: 100%; - height: auto; - position: relative; -} - -.circuit-36 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; +.circuit-45 { + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +.circuit-58 { + width: 100%; + height: auto; + position: relative; +} + +.circuit-36 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; display: flex; -webkit-align-items: center; -webkit-box-align: center; @@ -5449,7 +5377,7 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` z-index: -2; } -.circuit-59 { +.circuit-56 { width: 100%; display: -webkit-box; display: -webkit-flex; @@ -5559,7 +5487,7 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` margin-left: 8px; } -.circuit-57 { +.circuit-54 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5576,12 +5504,12 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` } @media (max-width:479px) { - .circuit-57 { + .circuit-54 { margin-left: 12px; } } -.circuit-48 { +.circuit-47 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5603,92 +5531,54 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-48:focus { +.circuit-47:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-48:focus::-moz-focus-inner { +.circuit-47:focus::-moz-focus-inner { border: 0; } -.circuit-48:disabled, -.circuit-48[disabled] { +.circuit-47:disabled, +.circuit-47[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-48:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-47:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-48:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-47:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-48:first-of-type { +.circuit-47:first-of-type { margin-left: 0; } -.circuit-48:active, -.circuit-48:focus, -.circuit-48:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-48 { - width: 24px; - height: 24px; - } - - .circuit-48 svg { - width: 25%; - } -} - -.circuit-45 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} -

@@ -5867,7 +5766,20 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` `; exports[`Storyshots Components/Carousel/Buttons All Buttons 1`] = ` -.circuit-3 { +.circuit-0 { + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +.circuit-2 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5889,87 +5801,49 @@ exports[`Storyshots Components/Carousel/Buttons All Buttons 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-3:focus { +.circuit-2:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-3:focus::-moz-focus-inner { +.circuit-2:focus::-moz-focus-inner { border: 0; } -.circuit-3:disabled, -.circuit-3[disabled] { +.circuit-2:disabled, +.circuit-2[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-3:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-2:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-3:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-2:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-3:first-of-type { +.circuit-2:first-of-type { margin-left: 0; } -.circuit-3:active, -.circuit-3:focus, -.circuit-3:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-3 { - width: 24px; - height: 24px; - } - - .circuit-3 svg { - width: 25%; - } -} - -.circuit-0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.circuit-16 { +.circuit-12 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5985,102 +5859,110 @@ exports[`Storyshots Components/Carousel/Buttons All Buttons 1`] = ` }
`; @@ -6307,7 +6189,6 @@ exports[`Storyshots Components/Hamburger Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -6316,6 +6197,7 @@ exports[`Storyshots Components/Hamburger Base 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; } @@ -6342,7 +6224,7 @@ exports[`Storyshots Components/Hamburger Base 1`] = ` .circuit-3:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-1 { @@ -6456,7 +6338,6 @@ exports[`Storyshots Components/Header Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -6465,6 +6346,7 @@ exports[`Storyshots Components/Header Base 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; } @@ -6491,7 +6373,7 @@ exports[`Storyshots Components/Header Base 1`] = ` .circuit-3:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-1 { @@ -6656,15 +6538,15 @@ exports[`Storyshots Components/Modal Base 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -6684,13 +6566,13 @@ exports[`Storyshots Components/Modal Base 1`] = ` } .circuit-0:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-0:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } @@ -7552,7 +7493,6 @@ exports[`Storyshots Components/Modal/Embedded With Title And Close Button 1`] = -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -7561,6 +7501,7 @@ exports[`Storyshots Components/Modal/Embedded With Title And Close Button 1`] = border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; } @@ -7587,7 +7528,7 @@ exports[`Storyshots Components/Modal/Embedded With Title And Close Button 1`] = .circuit-2:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-1 { @@ -7770,15 +7711,15 @@ exports[`Storyshots Components/Notification Alert 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 4px calc(16px - 1px); + border-radius: 6px; } .circuit-4:focus { @@ -7798,13 +7739,13 @@ exports[`Storyshots Components/Notification Alert 1`] = ` } .circuit-4:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-4:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } .circuit-3 { @@ -8131,15 +8072,15 @@ exports[`Storyshots Components/Notification Warning 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 4px calc(16px - 1px); + border-radius: 6px; } .circuit-4:focus { @@ -8159,13 +8100,13 @@ exports[`Storyshots Components/Notification Warning 1`] = ` } .circuit-4:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-4:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } .circuit-3 { @@ -8604,15 +8545,15 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 4px calc(16px - 1px); + border-radius: 6px; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; @@ -8635,13 +8576,13 @@ HTMLCollection [ } .circuit-1:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-1:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } .circuit-1:hover { @@ -8671,7 +8612,6 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -8680,6 +8620,7 @@ HTMLCollection [ border-color: #3388FF; color: #FFFFFF; padding: 4px calc(16px - 1px); + border-radius: 6px; border-radius: 0; border-right: 0; font-weight: 400; @@ -8756,7 +8697,6 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -8765,6 +8705,7 @@ HTMLCollection [ border-color: #9DA7B1; color: #323E49; padding: 4px calc(16px - 1px); + border-radius: 6px; border-radius: 0; border-right: 0; font-weight: 400; @@ -8794,7 +8735,7 @@ HTMLCollection [ .circuit-5:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-5:focus { @@ -8834,15 +8775,15 @@ HTMLCollection [ -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 4px calc(16px - 1px); + border-radius: 6px; border-top-left-radius: 0; border-bottom-left-radius: 0; } @@ -8864,13 +8805,13 @@ HTMLCollection [ } .circuit-13:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-13:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; }
@@ -10814,7 +10815,6 @@ exports[`Storyshots Components/Step Swiper 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -10823,6 +10823,7 @@ exports[`Storyshots Components/Step Swiper 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-3:focus { @@ -10848,7 +10849,7 @@ exports[`Storyshots Components/Step Swiper 1`] = ` .circuit-3:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-7 { @@ -13616,7 +13617,6 @@ exports[`Storyshots Components/Tag Removable 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -13625,6 +13625,7 @@ exports[`Storyshots Components/Tag Removable 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; margin-left: 4px; margin-right: -4px; @@ -13654,7 +13655,7 @@ exports[`Storyshots Components/Tag Removable 1`] = ` .circuit-2:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; }
diff --git a/src/components/Button/Button.spec.tsx b/src/components/Button/Button.spec.tsx index c4fc4c0a0b..8a1346fb27 100644 --- a/src/components/Button/Button.spec.tsx +++ b/src/components/Button/Button.spec.tsx @@ -67,11 +67,6 @@ describe('Button', () => { expect(wrapper).toMatchSnapshot(); }); - it('should render a giga button', () => { - const wrapper = renderButton(create, { ...baseProps, size: 'giga' }); - expect(wrapper).toMatchSnapshot(); - }); - it('should render a disabled button', () => { const wrapper = renderButton(create, { ...baseProps, disabled: true }); expect(wrapper).toMatchSnapshot(); diff --git a/src/components/Button/Button.story.tsx b/src/components/Button/Button.story.tsx index f9135e47ec..6a2c39d09b 100644 --- a/src/components/Button/Button.story.tsx +++ b/src/components/Button/Button.story.tsx @@ -32,7 +32,7 @@ export default { export const Primary = () => ( - ); @@ -64,7 +63,7 @@ export const WithIcon = () => ( diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 746d02f8d3..3ea06db1cc 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -34,7 +34,7 @@ export interface BaseProps { /** * Choose from 3 sizes. Default: 'mega'. */ - size?: 'kilo' | 'mega' | 'giga'; + size?: 'kilo' | 'mega'; /** * Visually and functionally disable the button. */ @@ -70,7 +70,6 @@ const baseStyles = ({ theme }: StyleProps) => css` text-align: center; text-decoration: none; font-weight: ${theme.fontWeight.bold}; - border-radius: ${theme.borderRadius.giga}; border-width: ${BORDER_WIDTH}; border-style: solid; transition: opacity ${theme.transitions.default}; @@ -87,7 +86,7 @@ const baseStyles = ({ theme }: StyleProps) => css` const primaryStyles = ({ theme, - variant = 'primary' + variant = 'secondary' }: ButtonProps & StyleProps) => variant === 'primary' && css` @@ -109,7 +108,7 @@ const primaryStyles = ({ const secondaryStyles = ({ theme, - variant = 'primary' + variant = 'secondary' }: ButtonProps & StyleProps) => variant === 'secondary' && css` @@ -125,13 +124,13 @@ const secondaryStyles = ({ &:active { background-color: ${theme.colors.n200}; - border-color: ${theme.colors.n700}; + border-color: ${theme.colors.n800}; } `; const tertiaryStyles = ({ theme, - variant = 'primary' + variant = 'secondary' }: ButtonProps & StyleProps) => variant === 'tertiary' && css` @@ -151,14 +150,19 @@ const tertiaryStyles = ({ const sizeStyles = ({ theme, size = 'mega' }: ButtonProps & StyleProps) => { const sizeMap = { - kilo: `${theme.spacings.bit} calc(${theme.spacings.mega} - ${BORDER_WIDTH})`, - mega: `${theme.spacings.byte} calc(${theme.spacings.giga} - ${BORDER_WIDTH})`, - giga: `${theme.spacings.kilo} calc(${theme.spacings.tera} - ${BORDER_WIDTH})` + kilo: { + padding: `${theme.spacings.bit} calc(${theme.spacings.mega} - ${BORDER_WIDTH})`, + borderRadius: '6px' + }, + mega: { + padding: `${theme.spacings.byte} calc(${theme.spacings.giga} - ${BORDER_WIDTH})`, + borderRadius: '8px' + } }; return css({ label: `button--${size}`, - padding: sizeMap[size] + ...sizeMap[size] }); }; diff --git a/src/components/Button/__snapshots__/Button.spec.tsx.snap b/src/components/Button/__snapshots__/Button.spec.tsx.snap index 78cdd56862..631af64af8 100644 --- a/src/components/Button/__snapshots__/Button.spec.tsx.snap +++ b/src/components/Button/__snapshots__/Button.spec.tsx.snap @@ -23,15 +23,15 @@ exports[`Button styles should render a button with icon 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; } .circuit-0:focus { @@ -51,13 +51,13 @@ exports[`Button styles should render a button with icon 1`] = ` } .circuit-0:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-0:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; } -`; - exports[`Button styles should render a kilo button 1`] = ` .circuit-0 { display: -webkit-box; @@ -242,15 +175,15 @@ exports[`Button styles should render a kilo button 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 4px calc(16px - 1px); + border-radius: 6px; } .circuit-0:focus { @@ -270,13 +203,13 @@ exports[`Button styles should render a kilo button 1`] = ` } .circuit-0:hover { - background-color: #1760CE; - border-color: #1760CE; + background-color: #FAFBFC; + border-color: #5C656F; } .circuit-0:active { - background-color: #003C8B; - border-color: #003C8B; + background-color: #EEF0F2; + border-color: #323E49; }
@@ -644,7 +628,7 @@ exports[`Carousel styles should render with children as a node 1`] = ` } } -.circuit-61 { +.circuit-58 { width: 100%; height: auto; position: relative; @@ -775,7 +759,7 @@ exports[`Carousel styles should render with children as a node 1`] = ` z-index: -2; } -.circuit-59 { +.circuit-56 { width: 100%; display: -webkit-box; display: -webkit-flex; @@ -885,7 +869,7 @@ exports[`Carousel styles should render with children as a node 1`] = ` margin-left: 8px; } -.circuit-57 { +.circuit-54 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -902,12 +886,12 @@ exports[`Carousel styles should render with children as a node 1`] = ` } @media (max-width:479px) { - .circuit-57 { + .circuit-54 { margin-left: 12px; } } -.circuit-48 { +.circuit-47 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -929,89 +913,64 @@ exports[`Carousel styles should render with children as a node 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-48:focus { +.circuit-47:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-48:focus::-moz-focus-inner { +.circuit-47:focus::-moz-focus-inner { border: 0; } -.circuit-48:disabled, -.circuit-48[disabled] { +.circuit-47:disabled, +.circuit-47[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-48:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-47:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-48:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-47:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-48:first-of-type { +.circuit-47:first-of-type { margin-left: 0; } -.circuit-48:active, -.circuit-48:focus, -.circuit-48:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-48 { - width: 24px; - height: 24px; - } - - .circuit-48 svg { - width: 25%; - } -} - .circuit-45 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; }

@@ -1238,7 +1206,7 @@ exports[`Carousel styles should render with default paused styles 1`] = ` } } -.circuit-61 { +.circuit-58 { width: 100%; height: auto; position: relative; @@ -1369,7 +1337,7 @@ exports[`Carousel styles should render with default paused styles 1`] = ` z-index: -2; } -.circuit-59 { +.circuit-56 { width: 100%; display: -webkit-box; display: -webkit-flex; @@ -1439,7 +1407,7 @@ exports[`Carousel styles should render with default paused styles 1`] = ` margin-left: 8px; } -.circuit-57 { +.circuit-54 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -1456,12 +1424,12 @@ exports[`Carousel styles should render with default paused styles 1`] = ` } @media (max-width:479px) { - .circuit-57 { + .circuit-54 { margin-left: 12px; } } -.circuit-48 { +.circuit-47 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -1483,84 +1451,59 @@ exports[`Carousel styles should render with default paused styles 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-48:focus { +.circuit-47:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-48:focus::-moz-focus-inner { +.circuit-47:focus::-moz-focus-inner { border: 0; } -.circuit-48:disabled, -.circuit-48[disabled] { +.circuit-47:disabled, +.circuit-47[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-48:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-47:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-48:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-47:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-48:first-of-type { +.circuit-47:first-of-type { margin-left: 0; } -.circuit-48:active, -.circuit-48:focus, -.circuit-48:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-48 { - width: 24px; - height: 24px; - } - - .circuit-48 svg { - width: 25%; - } -} - .circuit-45 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; } .circuit-41 { @@ -1605,7 +1548,7 @@ exports[`Carousel styles should render with default paused styles 1`] = `

@@ -1807,7 +1759,7 @@ exports[`Carousel styles should render with default styles 1`] = ` } } -.circuit-61 { +.circuit-58 { width: 100%; height: auto; position: relative; @@ -1938,7 +1890,7 @@ exports[`Carousel styles should render with default styles 1`] = ` z-index: -2; } -.circuit-59 { +.circuit-56 { width: 100%; display: -webkit-box; display: -webkit-flex; @@ -2048,7 +2000,7 @@ exports[`Carousel styles should render with default styles 1`] = ` margin-left: 8px; } -.circuit-57 { +.circuit-54 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -2065,12 +2017,12 @@ exports[`Carousel styles should render with default styles 1`] = ` } @media (max-width:479px) { - .circuit-57 { + .circuit-54 { margin-left: 12px; } } -.circuit-48 { +.circuit-47 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -2092,89 +2044,64 @@ exports[`Carousel styles should render with default styles 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-48:focus { +.circuit-47:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-48:focus::-moz-focus-inner { +.circuit-47:focus::-moz-focus-inner { border: 0; } -.circuit-48:disabled, -.circuit-48[disabled] { +.circuit-47:disabled, +.circuit-47[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-48:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-47:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-48:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-47:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-48:first-of-type { +.circuit-47:first-of-type { margin-left: 0; } -.circuit-48:active, -.circuit-48:focus, -.circuit-48:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-48 { - width: 24px; - height: 24px; - } - - .circuit-48 svg { - width: 25%; - } -} - .circuit-45 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; }

diff --git a/src/components/Carousel/components/Buttons/Buttons.js b/src/components/Carousel/components/Buttons/Buttons.js index 040d0787f4..64ded076a2 100644 --- a/src/components/Carousel/components/Buttons/Buttons.js +++ b/src/components/Carousel/components/Buttons/Buttons.js @@ -19,7 +19,7 @@ import styled from '@emotion/styled'; import { css } from '@emotion/core'; import { ChevronLeft, ChevronRight, Pause, Play } from '@sumup/icons'; -import CircuitUIButton from '../../../Button'; +import IconButton from '../../../IconButton'; const buttonListStyles = css` label: carousel__buttonlist; @@ -27,68 +27,39 @@ const buttonListStyles = css` align-items: center; justify-content: center; `; + export const ButtonList = styled('div')(buttonListStyles); -const baseButtonStyles = ({ theme }) => css` +const buttonStyles = ({ theme }) => css` label: carousel__button; - background-color: ${theme.colors.n300}; - width: ${theme.iconSizes.giga}; - height: ${theme.iconSizes.giga}; - padding: 0; - overflow: hidden; - border-radius: 50%; - margin-left: ${theme.spacings.byte}; &:first-of-type { margin-left: 0; } - &:active, - &:focus, - &:hover { - padding: 0; - } - - ${theme.mq.untilKilo} { - width: ${theme.iconSizes.mega}; - height: ${theme.iconSizes.mega}; - - svg { - width: 25%; - } - } `; -export const Button = styled(CircuitUIButton)(baseButtonStyles); -// wrapping button content due to flex bug in Safari 10.1 -// via https://github.com/philipwalton/flexbugs/issues/236 -const innerWrapperStyles = css` - label: carousel__button--innerwrapper; - display: flex; - justify-content: center; - align-items: center; -`; -const InnerWrapper = styled('div')(innerWrapperStyles); +export const Button = styled(IconButton)(buttonStyles); + +Button.defaultProps = { + size: 'kilo' +}; export const NextButton = props => ( - ); export const PrevButton = props => ( - ); export const PlayButton = ({ paused, ...props }) => ( - ); diff --git a/src/components/Carousel/components/Buttons/__snapshots__/Buttons.spec.js.snap b/src/components/Carousel/components/Buttons/__snapshots__/Buttons.spec.js.snap index e21ab4cec4..9552819e34 100644 --- a/src/components/Carousel/components/Buttons/__snapshots__/Buttons.spec.js.snap +++ b/src/components/Carousel/components/Buttons/__snapshots__/Buttons.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Buttons styles should render with default styles 1`] = ` -.circuit-16 { +.circuit-12 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -16,7 +16,7 @@ exports[`Buttons styles should render with default styles 1`] = ` justify-content: center; } -.circuit-3 { +.circuit-2 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -38,183 +38,166 @@ exports[`Buttons styles should render with default styles 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out; - background-color: #3388FF; - border-color: #3388FF; - color: #FFFFFF; + background-color: #FFFFFF; + border-color: #9DA7B1; + color: #323E49; padding: 8px calc(24px - 1px); - background-color: #D8DDE1; - width: 32px; - height: 32px; - padding: 0; - overflow: hidden; - border-radius: 50%; + border-radius: 8px; margin-left: 8px; } -.circuit-3:focus { +.circuit-2:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-3:focus::-moz-focus-inner { +.circuit-2:focus::-moz-focus-inner { border: 0; } -.circuit-3:disabled, -.circuit-3[disabled] { +.circuit-2:disabled, +.circuit-2[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-3:hover { - background-color: #1760CE; - border-color: #1760CE; +.circuit-2:hover { + background-color: #FAFBFC; + border-color: #5C656F; } -.circuit-3:active { - background-color: #003C8B; - border-color: #003C8B; +.circuit-2:active { + background-color: #EEF0F2; + border-color: #323E49; } -.circuit-3:first-of-type { +.circuit-2:first-of-type { margin-left: 0; } -.circuit-3:active, -.circuit-3:focus, -.circuit-3:hover { - padding: 0; -} - -@media (max-width:479px) { - .circuit-3 { - width: 24px; - height: 24px; - } - - .circuit-3 svg { - width: 25%; - } -} - .circuit-0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + border: 0; + -webkit-clip: rect(0 0 0 0); + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; }
`; diff --git a/src/components/CloseButton/CloseButton.js b/src/components/CloseButton/CloseButton.js index 89a33ab7f6..01e0e69bb0 100644 --- a/src/components/CloseButton/CloseButton.js +++ b/src/components/CloseButton/CloseButton.js @@ -27,7 +27,7 @@ const buttonStyles = () => css` * A generic close button. */ const CloseButton = props => ( - + ); diff --git a/src/components/CloseButton/__snapshots__/CloseButton.spec.js.snap b/src/components/CloseButton/__snapshots__/CloseButton.spec.js.snap index 2c74403f36..4bd9633f9c 100644 --- a/src/components/CloseButton/__snapshots__/CloseButton.spec.js.snap +++ b/src/components/CloseButton/__snapshots__/CloseButton.spec.js.snap @@ -23,7 +23,6 @@ exports[`CloseButton should render with default styles 1`] = ` -webkit-text-decoration: none; text-decoration: none; font-weight: 700; - border-radius: 5px; border-width: 1px; border-style: solid; -webkit-transition: opacity 200ms ease-in-out; @@ -32,6 +31,7 @@ exports[`CloseButton should render with default styles 1`] = ` border-color: #9DA7B1; color: #323E49; padding: 8px calc(24px - 1px); + border-radius: 8px; border: 0; } @@ -58,7 +58,7 @@ exports[`CloseButton should render with default styles 1`] = ` .circuit-1:active { background-color: #EEF0F2; - border-color: #5C656F; + border-color: #323E49; } .circuit-0 { diff --git a/src/components/Hamburger/Hamburger.tsx b/src/components/Hamburger/Hamburger.tsx index 386b9c6743..707a7b0f34 100644 --- a/src/components/Hamburger/Hamburger.tsx +++ b/src/components/Hamburger/Hamburger.tsx @@ -132,12 +132,7 @@ export const Hamburger: FC = ({ labelInActive = 'Open menu', ...props }: HamburgerProps) => ( -