From 662569929d441a1a04f08f13066d7f594f204b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20B=C3=A4r?= Date: Wed, 3 Jun 2020 17:07:21 +0200 Subject: [PATCH] feat(components): update design of ProgressBar (#602) * refactor(components): migrate ProgressBar to TypeScript * feat(components): add secondary variant for ProgressBar * feat(components): add time-based ProgressBar * feat(components): replace progress component in Carousel * refactor(components): update wording Co-authored-by: amelako Co-authored-by: fernandofleury --- scripts/static-styles/config.js | 2 +- src/__snapshots__/storyshots.spec.js.snap | 1194 ++++++++++------- src/components/Carousel/Carousel.js | 12 +- .../__snapshots__/Carousel.spec.js.snap | 530 +++++--- .../Carousel/components/Progress/Progress.js | 81 -- .../components/Progress/Progress.story.js | 38 - .../__snapshots__/Progress.spec.js.snap | 232 ---- .../Carousel/components/Progress/index.js | 18 - src/components/Carousel/index.js | 2 - .../ProgressBar/ProgressBar.docs.mdx | 38 +- src/components/ProgressBar/ProgressBar.js | 151 --- .../ProgressBar/ProgressBar.spec.js | 42 - .../ProgressBar.spec.tsx} | 48 +- .../ProgressBar/ProgressBar.story.js | 108 -- .../ProgressBar/ProgressBar.story.tsx | 97 ++ src/components/ProgressBar/ProgressBar.tsx | 243 ++++ .../__snapshots__/ProgressBar.spec.js.snap | 131 -- .../__snapshots__/ProgressBar.spec.tsx.snap | 340 +++++ .../ProgressBar/{index.js => index.ts} | 2 +- 19 files changed, 1810 insertions(+), 1499 deletions(-) delete mode 100644 src/components/Carousel/components/Progress/Progress.js delete mode 100644 src/components/Carousel/components/Progress/Progress.story.js delete mode 100644 src/components/Carousel/components/Progress/__snapshots__/Progress.spec.js.snap delete mode 100644 src/components/Carousel/components/Progress/index.js delete mode 100644 src/components/ProgressBar/ProgressBar.js delete mode 100644 src/components/ProgressBar/ProgressBar.spec.js rename src/components/{Carousel/components/Progress/Progress.spec.js => ProgressBar/ProgressBar.spec.tsx} (51%) delete mode 100644 src/components/ProgressBar/ProgressBar.story.js create mode 100644 src/components/ProgressBar/ProgressBar.story.tsx create mode 100644 src/components/ProgressBar/ProgressBar.tsx delete mode 100644 src/components/ProgressBar/__snapshots__/ProgressBar.spec.js.snap create mode 100644 src/components/ProgressBar/__snapshots__/ProgressBar.spec.tsx.snap rename src/components/ProgressBar/{index.js => index.ts} (93%) diff --git a/scripts/static-styles/config.js b/scripts/static-styles/config.js index 7328cf7ae7..fe1aa8eafa 100644 --- a/scripts/static-styles/config.js +++ b/scripts/static-styles/config.js @@ -171,7 +171,7 @@ export default { // }), // TODO: Need to eliminate dynamic styles. // getComponentInfo(ProgressBar, { - // size: [ProgressBar.KILO, ProgressBar.MEGA, ProgressBar.GIGA] + // size: ['kilo', 'mega', 'giga'] // }), getComponentInfo(RadioButton), getComponentInfo(Select, { diff --git a/src/__snapshots__/storyshots.spec.js.snap b/src/__snapshots__/storyshots.spec.js.snap index f9593f9baf..3d141dda57 100644 --- a/src/__snapshots__/storyshots.spec.js.snap +++ b/src/__snapshots__/storyshots.spec.js.snap @@ -5299,13 +5299,13 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` 100% { width: 100%; - -webkit-transform: translateX(102%); - -ms-transform: translateX(102%); - transform: translateX(102%); + -webkit-transform: translateX(100%); + -ms-transform: translateX(100%); + transform: translateX(100%); } } -.circuit-59 { +.circuit-61 { width: 100%; height: auto; position: relative; @@ -5436,7 +5436,7 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` z-index: -2; } -.circuit-57 { +.circuit-59 { width: 100%; display: -webkit-box; display: -webkit-flex; @@ -5486,21 +5486,48 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` } } -.circuit-41 { - width: 100%; - height: 2px; - overflow: hidden; - background-color: #EEF0F2; - border-radius: 5px; +.circuit-44 { + 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-flex: 1 1 auto; -ms-flex: 1 1 auto; flex: 1 1 auto; } -.circuit-41:after { +.circuit-41 { + background-color: #EEF0F2; + border-radius: 999999px; + position: relative; + width: 100%; + overflow: hidden; + height: 4px; +} + +.circuit-41::after { content: ''; display: block; - background-color: #0F131A; + position: absolute; + top: 0; + bottom: 0; + left: 0; + background-color: #3388FF; + -webkit-transition: width 0.05s ease-out; + transition: width 0.05s ease-out; + height: 100%; + width: 1px; +} + +.circuit-41::after { + background-color: #212933; +} + +.circuit-41::after { -webkit-animation-name: animation-0; animation-name: animation-0; -webkit-animation-duration: 5640ms; @@ -5509,12 +5536,17 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` animation-play-state: running; -webkit-animation-fill-mode: forwards; animation-fill-mode: forwards; - -webkit-animation-iteration-count: 1; - animation-iteration-count: 1; - height: 100%; + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; +} + +.circuit-42 { + font-size: 13px; + line-height: 20px; + margin-left: 8px; } -.circuit-55 { +.circuit-57 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5531,12 +5563,12 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` } @media (max-width:479px) { - .circuit-55 { + .circuit-57 { margin-left: 12px; } } -.circuit-46 { +.circuit-48 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5576,54 +5608,54 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` margin-left: 8px; } -.circuit-46:focus { +.circuit-48:focus { outline: 0; box-shadow: 0 0 0 4px #AFD0FE; } -.circuit-46:focus::-moz-focus-inner { +.circuit-48:focus::-moz-focus-inner { border: 0; } -.circuit-46:disabled, -.circuit-46[disabled] { +.circuit-48:disabled, +.circuit-48[disabled] { opacity: 0.5; pointer-events: none; box-shadow: none; } -.circuit-46:hover { +.circuit-48:hover { background-color: #1760CE; border-color: #1760CE; } -.circuit-46:active { +.circuit-48:active { background-color: #003C8B; border-color: #003C8B; } -.circuit-46:first-of-type { +.circuit-48:first-of-type { margin-left: 0; } -.circuit-46:active, -.circuit-46:focus, -.circuit-46:hover { +.circuit-48:active, +.circuit-48:focus, +.circuit-48:hover { padding: 0; } @media (max-width:479px) { - .circuit-46 { + .circuit-48 { width: 24px; height: 24px; } - .circuit-46 svg { + .circuit-48 svg { width: 25%; } } -.circuit-43 { +.circuit-45 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -5643,7 +5675,7 @@ exports[`Storyshots Components/Carousel Stateful 1`] = ` >

+ class="circuit-43 circuit-44" + > + + +
@@ -13977,14 +14213,14 @@ exports[`Storyshots Forms/Checkbox Base 1`] = ` >