-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add:
xs
size to LoadingSpinner (#5148)
* add xs to LoadingSpinner, update render method to switch and migrate to css vars * add changeset * update docs * move spinner icons into a subcomponent * update css specificity * update to px values * remove redundant stickersheet col * update docs and outline current colors used in Figma for spinner * Update packages/components/src/Loading/LoadingSpinner/_docs/LoadingSpinner.stories.tsx Co-authored-by: Cassandra <[email protected]> * Update stickersheet story for icon xs for Button examples and clean up LoadingSpinenr stories --------- Co-authored-by: Cassandra <[email protected]>
- Loading branch information
1 parent
4048050
commit 3e2d4e6
Showing
10 changed files
with
165 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kaizen/components": minor | ||
--- | ||
|
||
Add `xs` size to LoadingSpinner |
32 changes: 32 additions & 0 deletions
32
packages/components/src/Loading/LoadingSpinner/LoadingSpinner.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.loadingSpinner { | ||
--loading-spinner-size: 48px; | ||
|
||
display: flex; | ||
width: var(--loading-spinner-size); | ||
height: var(--loading-spinner-size); | ||
} | ||
|
||
.xs { | ||
--loading-spinner-size: 16px; | ||
} | ||
|
||
.sm { | ||
--loading-spinner-size: 24px; | ||
} | ||
|
||
.md { | ||
--loading-spinner-size: 48px; | ||
} | ||
|
||
.spinner { | ||
animation: spinner var(--animation-duration-deliberate) | ||
var(--animation-easing-function-ease-in-out) infinite; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
@keyframes spinner { | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
packages/components/src/Loading/LoadingSpinner/LoadingSpinner.module.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
packages/components/src/Loading/LoadingSpinner/subcomponents/SpinnerIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from "react" | ||
import styles from "../LoadingSpinner.module.css" | ||
|
||
const SmallSpinnerIcon = (): JSX.Element => ( | ||
<svg | ||
className={styles.spinner} | ||
aria-hidden="true" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<circle | ||
cx="12" | ||
cy="12" | ||
r="9" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeOpacity="0.3" | ||
/> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
fill="currentColor" | ||
d="M21.0564 13c.5076 0 .9377-.3851.9431-.8926.0004-.0358.0005-.0716.0005-.1074 0-5.52285-4.4771-10-10-10-.0359 0-.0718.00019-.1076.00057-.5076.00535-.8926.43552-.8926.94308v.11543C10.9998 3.59163 11.4675 4 12 4c4.4183 0 8 3.58172 8 8 0 .5324.4083 1 .9407 1h.1157z" | ||
/> | ||
</svg> | ||
) | ||
|
||
const MediumSpinnerIcon = (): JSX.Element => ( | ||
<svg | ||
className={styles.spinner} | ||
aria-hidden="true" | ||
viewBox="0 0 48 48" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<circle | ||
cx="24" | ||
cy="24" | ||
r="22.5" | ||
stroke="currentColor" | ||
strokeWidth="3" | ||
strokeOpacity="0.3" | ||
/> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
fill="currentColor" | ||
d="M46.5 24c.8284 0 1.5049-.6734 1.4539-1.5002C47.21 10.44 37.5601.789989 25.5003.0461639 24.6734-.004835 24 .671607 24 1.50003c0 .82843.6738 1.49444 1.5002 1.55277 10.4023.73424 18.7128 9.0447 19.447 19.447C45.0056 23.3262 45.6716 24 46.5 24z" | ||
/> | ||
</svg> | ||
) | ||
|
||
const ExtraSmallSpinnerIcon = (): JSX.Element => ( | ||
<svg | ||
className={styles.spinner} | ||
viewBox="0 0 16 16" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<circle | ||
opacity="0.3" | ||
cx="8" | ||
cy="8" | ||
r="6" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
/> | ||
<path | ||
d="M14 8C14 4.68629 11.3137 2 8 2" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
) | ||
|
||
type SpinnerIconProps = { | ||
size: "xs" | "sm" | "md" | ||
} | ||
|
||
export const SpinnerIcon = ({ size }: SpinnerIconProps): JSX.Element => { | ||
if (size === "xs") return <ExtraSmallSpinnerIcon /> | ||
if (size === "sm") return <SmallSpinnerIcon /> | ||
return <MediumSpinnerIcon /> | ||
} |
1 change: 1 addition & 0 deletions
1
packages/components/src/Loading/LoadingSpinner/subcomponents/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./SpinnerIcon" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters