From c43c8c0783f16de6bf4dddc15d347508c2e11412 Mon Sep 17 00:00:00 2001 From: Damien Erambert Date: Mon, 21 Aug 2023 14:56:49 -0700 Subject: [PATCH 1/4] feat: add `Loader` component --- src/assets/images/loader.png | Bin 0 -> 5020 bytes src/assets/images/loaderGrey.png | Bin 0 -> 4931 bytes src/assets/images/loaderGreySmall.png | Bin 0 -> 2148 bytes src/assets/images/loaderSmall.png | Bin 0 -> 2153 bytes src/components/loader/__docs__/docs.mdx | 28 ++++++ .../loader/__docs__/index.stories.tsx | 28 ++++++ .../loader/__docs__/stories/basic.stories.tsx | 19 ++++ src/components/loader/loader.tsx | 89 ++++++++++++++++++ src/custom.d.ts | 11 ++- 9 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 src/assets/images/loader.png create mode 100644 src/assets/images/loaderGrey.png create mode 100644 src/assets/images/loaderGreySmall.png create mode 100644 src/assets/images/loaderSmall.png create mode 100644 src/components/loader/__docs__/docs.mdx create mode 100644 src/components/loader/__docs__/index.stories.tsx create mode 100644 src/components/loader/__docs__/stories/basic.stories.tsx create mode 100644 src/components/loader/loader.tsx diff --git a/src/assets/images/loader.png b/src/assets/images/loader.png new file mode 100644 index 0000000000000000000000000000000000000000..c897b94f504205a5b4ef67643c9c83e8f9244e3d GIT binary patch literal 5020 zcmV;N6JzX&P)Px|R!KxbRCodHTzhOB$9ex|XZLu=GnJI?P4*b-jgwZxsMjYfdfy`5S4Z;gLvHKv2StXsnh(DB z*>~zv1Fd)Z!oGuqcc&(64H^I(v;a&fQ1W;D3-VFo90>rZgjSLOB(US(1^$#N0V*o% zceM~lQSnH$UI04KTE-e^k#LXq7n7h%o=8<;6uf;6U5}y`u0Oz8=hIItbFu(k{fH zrRWDSYxux?i}$<&xMlBfm(t=vP6G66-Q>BJ&HE;G{VLSiym~ zlL0OOkU1PW6x<2ric@$VIu3QtN=tm>b+`2pgFGK;UI5&-yMI}(F7|*{{zlVgW~veg z8D$R+3jhR%_@INaECC4KJWoph-jeb(dH!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n-*21;2HsY9 zO*#JB0w<1@mJ%0M9v9I^ZWccJWNoyOY<-IeYyr?jm94vT73Qm%#pfH`2m+X^P>9~? z9ADgqkx&V!``8C@K?eg&BIBfE1OI}+$`}7T%{$o6>8)e%giuI?ixmwW?BLL0jMS0d z>)dZ-{pOp5kUE_hYe%l5t(>(+-_Fqvt0q?a7CfBpys(jVe)qfXFzuprj%;m?8I=rFRoCDk+8Gbw*O}{sf`52vN+YqQ{4&6NcYaR!@x=CoqXln14T!gi&EPdbjFU9 zx=?m6=O#x7<0=Ul$}<}a$mXcF{V&VV^AuQVDVt&PpZ*e|i&Y*1nLF4f7W zEKx{O#tk8IyBi4U7ve#yntvxHT2>hBgpS6cfv;xEcWe+o+H)x1W6J;b_|i=wbST8+ zd)r%!06D)!E^-RskrZg;>YT=yvAd4UkFGb!-N?a3Yq%$>H>Hk{d?Id6e`p}&Fgen&fX$CPpbPXhZck7 zD}2tqPnUK!!f0O-8^$iMa*iVM1HA*skAG9t))F9tD^q&$jy|0-*)#aU1pI1&CR-U*b2vT9 zsb&+WK8Q-4J{w`ipQ z{pkbv_UkB*ykONkZ&kBW*G9FMGZ8Y5RJ~#&2X&l@oMv3xm&si27)JM$OBn1tY%`gM zt4ZzQEf7Z`nv+8KA)Q1%DvV>R^FDd!ji;&uZoS#6ok^6tN+0#IzVDWsUfRaxe&dOZ zF=;I{e64F@B|IbQp^b2I*w^D;I{B^s($&m$a4ZY3^TM4^6}BO$9gpHL#m1v#PsHw0 z%ZAmceM+}9ALW=>bIQtEAvDr!m5OlSVoeBl0AS?%5!afEMgW*nBcbD^F1-2#!o3eD zi$@>Jz4Q8a2mhltzx{heJ*Sm)u%t15oVY@{0idmn-74ALUYHeol7*AwOS+qkN8Y9V zI`#HS;CS?k3@(UBDn4LpP~T2V-e#Cy4~J + +# Loader + + + + + + + + +```typescript +import {Loader} from '@frontapp/ui-kit'; +``` + +Indicates that content is loading or that an action is taking place. + +
+ +## Props + + + +
+
diff --git a/src/components/loader/__docs__/index.stories.tsx b/src/components/loader/__docs__/index.stories.tsx new file mode 100644 index 0000000..7f763dc --- /dev/null +++ b/src/components/loader/__docs__/index.stories.tsx @@ -0,0 +1,28 @@ +/* eslint-disable storybook/story-exports */ +import {ComponentMeta} from '@storybook/react'; + +import {Loader} from '../loader'; +import DocumentationMDX from './docs.mdx'; + +/* + * Storybook. + */ + +export default { + title: 'Components/Loader', + component: Loader, + parameters: { + docs: { + page: DocumentationMDX + }, + previewTabs: { + canvas: { + hidden: true + } + }, + viewMode: 'docs' + }, + id: 'Components/Loader' +} as ComponentMeta; + +export {Basic, Big} from './stories/basic.stories'; diff --git a/src/components/loader/__docs__/stories/basic.stories.tsx b/src/components/loader/__docs__/stories/basic.stories.tsx new file mode 100644 index 0000000..b3d6b9e --- /dev/null +++ b/src/components/loader/__docs__/stories/basic.stories.tsx @@ -0,0 +1,19 @@ +import {ComponentStory} from '@storybook/react'; +import React from 'react'; + +import {VisualSizesEnum} from '../../../../helpers/fontHelpers'; +import {Loader, LoaderColorVariantsEnum} from '../../loader'; + +export const Basic: ComponentStory = (args) => ( +
+ + +
+); + +export const Big: ComponentStory = (args) => ( +
+ + +
+); diff --git a/src/components/loader/loader.tsx b/src/components/loader/loader.tsx new file mode 100644 index 0000000..69a8912 --- /dev/null +++ b/src/components/loader/loader.tsx @@ -0,0 +1,89 @@ +import React, {FC} from 'react'; +import styled, {css, keyframes} from 'styled-components'; + +import loader from '../../assets/images/loader.png'; +import loaderGrey from '../../assets/images/loaderGrey.png'; +import loaderGreySmall from '../../assets/images/loaderGreySmall.png'; +import loaderSmall from '../../assets/images/loaderSmall.png'; +import {VisualSizesEnum} from '../../helpers/fontHelpers'; +import {makeSizeConstants} from '../../helpers/styleHelpers'; + +/* + * Props. + */ + +export enum LoaderColorVariantsEnum { + BLUE = 'BASE', + GREY = 'GREY' +} + +interface LoaderProps { + className?: string; + /** Size of the loader. */ + size?: VisualSizesEnum; + /** Color scheme of the loader. */ + color?: LoaderColorVariantsEnum; + /** Whether or not the loader rotates. */ + isEnabled?: boolean; +} + +const defaultProps = { + size: VisualSizesEnum.LARGE, + variant: LoaderColorVariantsEnum.BLUE, + isEnabled: true +}; + +/* + * Style. + */ + +const sizes = makeSizeConstants(16, 20, 40); +const images = { + [LoaderColorVariantsEnum.BLUE]: makeSizeConstants(loaderSmall, loaderSmall, loader), + [LoaderColorVariantsEnum.GREY]: makeSizeConstants(loaderGreySmall, loaderGreySmall, loaderGrey) +}; + +interface LoaderStyleProps { + $size: VisualSizesEnum; + $variant: LoaderColorVariantsEnum; + $isEnabled: boolean; +} +const StyledLoaderDiv = styled.div` + width: ${(p) => sizes[p.$size]}px; + height: ${(p) => sizes[p.$size]}px; + background-image: url(${(p) => images[p.$variant][p.$size]}); + background-size: ${(p) => sizes[p.$size]}px; + + ${(p) => maybeAnimate(p.$isEnabled)}; +`; + +const rotate360 = keyframes` + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +`; + +function maybeAnimate(isEnabled: boolean) { + if (!isEnabled) return ''; + + return css` + animation: ${rotate360} 0.6s linear infinite; + `; +} + +/* + * Component. + */ + +export const Loader: FC = (props) => ( + +); diff --git a/src/custom.d.ts b/src/custom.d.ts index b1719a4..4445e1b 100644 --- a/src/custom.d.ts +++ b/src/custom.d.ts @@ -1,7 +1,14 @@ /* eslint-disable import/no-default-export */ -declare module "*.svg" { - const ReactComponent: (props: React.SVGAttributes) => React.ReactElement>; +declare module '*.svg' { + const ReactComponent: ( + props: React.SVGAttributes + ) => React.ReactElement>; export {ReactComponent}; export default ReactComponent; } + +declare module '*.png' { + const content: string; + export default content; +} From 932b820e4559291bfbf6862587ae87cba29c9941 Mon Sep 17 00:00:00 2001 From: Damien Erambert Date: Mon, 21 Aug 2023 15:11:40 -0700 Subject: [PATCH 2/4] :shirt: --- .../loader/__docs__/stories/basic.stories.tsx | 4 ++-- src/components/loader/loader.tsx | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/loader/__docs__/stories/basic.stories.tsx b/src/components/loader/__docs__/stories/basic.stories.tsx index b3d6b9e..cd63bf8 100644 --- a/src/components/loader/__docs__/stories/basic.stories.tsx +++ b/src/components/loader/__docs__/stories/basic.stories.tsx @@ -4,14 +4,14 @@ import React from 'react'; import {VisualSizesEnum} from '../../../../helpers/fontHelpers'; import {Loader, LoaderColorVariantsEnum} from '../../loader'; -export const Basic: ComponentStory = (args) => ( +export const Basic: ComponentStory = args => (
); -export const Big: ComponentStory = (args) => ( +export const Big: ComponentStory = args => (
diff --git a/src/components/loader/loader.tsx b/src/components/loader/loader.tsx index 69a8912..e1c83d0 100644 --- a/src/components/loader/loader.tsx +++ b/src/components/loader/loader.tsx @@ -49,12 +49,12 @@ interface LoaderStyleProps { $isEnabled: boolean; } const StyledLoaderDiv = styled.div` - width: ${(p) => sizes[p.$size]}px; - height: ${(p) => sizes[p.$size]}px; - background-image: url(${(p) => images[p.$variant][p.$size]}); - background-size: ${(p) => sizes[p.$size]}px; + width: ${p => sizes[p.$size]}px; + height: ${p => sizes[p.$size]}px; + background-image: url(${p => images[p.$variant][p.$size]}); + background-size: ${p => sizes[p.$size]}px; - ${(p) => maybeAnimate(p.$isEnabled)}; + ${p => maybeAnimate(p.$isEnabled)}; `; const rotate360 = keyframes` @@ -67,7 +67,8 @@ const rotate360 = keyframes` `; function maybeAnimate(isEnabled: boolean) { - if (!isEnabled) return ''; + if (!isEnabled) + return ''; return css` animation: ${rotate360} 0.6s linear infinite; @@ -78,7 +79,7 @@ function maybeAnimate(isEnabled: boolean) { * Component. */ -export const Loader: FC = (props) => ( +export const Loader: FC = props => ( Date: Mon, 21 Aug 2023 15:16:40 -0700 Subject: [PATCH 3/4] run prettier --- .../loader/__docs__/stories/basic.stories.tsx | 4 ++-- src/components/loader/loader.tsx | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/loader/__docs__/stories/basic.stories.tsx b/src/components/loader/__docs__/stories/basic.stories.tsx index cd63bf8..b3d6b9e 100644 --- a/src/components/loader/__docs__/stories/basic.stories.tsx +++ b/src/components/loader/__docs__/stories/basic.stories.tsx @@ -4,14 +4,14 @@ import React from 'react'; import {VisualSizesEnum} from '../../../../helpers/fontHelpers'; import {Loader, LoaderColorVariantsEnum} from '../../loader'; -export const Basic: ComponentStory = args => ( +export const Basic: ComponentStory = (args) => (
); -export const Big: ComponentStory = args => ( +export const Big: ComponentStory = (args) => (
diff --git a/src/components/loader/loader.tsx b/src/components/loader/loader.tsx index e1c83d0..69a8912 100644 --- a/src/components/loader/loader.tsx +++ b/src/components/loader/loader.tsx @@ -49,12 +49,12 @@ interface LoaderStyleProps { $isEnabled: boolean; } const StyledLoaderDiv = styled.div` - width: ${p => sizes[p.$size]}px; - height: ${p => sizes[p.$size]}px; - background-image: url(${p => images[p.$variant][p.$size]}); - background-size: ${p => sizes[p.$size]}px; + width: ${(p) => sizes[p.$size]}px; + height: ${(p) => sizes[p.$size]}px; + background-image: url(${(p) => images[p.$variant][p.$size]}); + background-size: ${(p) => sizes[p.$size]}px; - ${p => maybeAnimate(p.$isEnabled)}; + ${(p) => maybeAnimate(p.$isEnabled)}; `; const rotate360 = keyframes` @@ -67,8 +67,7 @@ const rotate360 = keyframes` `; function maybeAnimate(isEnabled: boolean) { - if (!isEnabled) - return ''; + if (!isEnabled) return ''; return css` animation: ${rotate360} 0.6s linear infinite; @@ -79,7 +78,7 @@ function maybeAnimate(isEnabled: boolean) { * Component. */ -export const Loader: FC = props => ( +export const Loader: FC = (props) => ( Date: Tue, 22 Aug 2023 09:52:14 -0700 Subject: [PATCH 4/4] feedback --- .../loader/__docs__/stories/basic.stories.tsx | 11 ++++---- src/components/loader/loader.tsx | 26 ++++++++----------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/components/loader/__docs__/stories/basic.stories.tsx b/src/components/loader/__docs__/stories/basic.stories.tsx index b3d6b9e..5de2f9f 100644 --- a/src/components/loader/__docs__/stories/basic.stories.tsx +++ b/src/components/loader/__docs__/stories/basic.stories.tsx @@ -1,19 +1,20 @@ import {ComponentStory} from '@storybook/react'; import React from 'react'; +import {PaletteColorsEnum} from '../../../../helpers/colorHelpers'; import {VisualSizesEnum} from '../../../../helpers/fontHelpers'; -import {Loader, LoaderColorVariantsEnum} from '../../loader'; +import {Loader} from '../../loader'; export const Basic: ComponentStory = (args) => (
- - + +
); export const Big: ComponentStory = (args) => (
- - + +
); diff --git a/src/components/loader/loader.tsx b/src/components/loader/loader.tsx index 69a8912..fe74cc6 100644 --- a/src/components/loader/loader.tsx +++ b/src/components/loader/loader.tsx @@ -5,6 +5,7 @@ import loader from '../../assets/images/loader.png'; import loaderGrey from '../../assets/images/loaderGrey.png'; import loaderGreySmall from '../../assets/images/loaderGreySmall.png'; import loaderSmall from '../../assets/images/loaderSmall.png'; +import {PaletteColorsEnum} from '../../helpers/colorHelpers'; import {VisualSizesEnum} from '../../helpers/fontHelpers'; import {makeSizeConstants} from '../../helpers/styleHelpers'; @@ -12,26 +13,21 @@ import {makeSizeConstants} from '../../helpers/styleHelpers'; * Props. */ -export enum LoaderColorVariantsEnum { - BLUE = 'BASE', - GREY = 'GREY' -} - interface LoaderProps { className?: string; /** Size of the loader. */ size?: VisualSizesEnum; /** Color scheme of the loader. */ - color?: LoaderColorVariantsEnum; + color?: PaletteColorsEnum.GREY | PaletteColorsEnum.BLUE; /** Whether or not the loader rotates. */ - isEnabled?: boolean; + isAnimated?: boolean; } const defaultProps = { size: VisualSizesEnum.LARGE, - variant: LoaderColorVariantsEnum.BLUE, - isEnabled: true -}; + color: PaletteColorsEnum.BLUE, + isAnimated: true +} as const; /* * Style. @@ -39,13 +35,13 @@ const defaultProps = { const sizes = makeSizeConstants(16, 20, 40); const images = { - [LoaderColorVariantsEnum.BLUE]: makeSizeConstants(loaderSmall, loaderSmall, loader), - [LoaderColorVariantsEnum.GREY]: makeSizeConstants(loaderGreySmall, loaderGreySmall, loaderGrey) + [PaletteColorsEnum.BLUE]: makeSizeConstants(loaderSmall, loaderSmall, loader), + [PaletteColorsEnum.GREY]: makeSizeConstants(loaderGreySmall, loaderGreySmall, loaderGrey) }; interface LoaderStyleProps { $size: VisualSizesEnum; - $variant: LoaderColorVariantsEnum; + $variant: PaletteColorsEnum.GREY | PaletteColorsEnum.BLUE; $isEnabled: boolean; } const StyledLoaderDiv = styled.div` @@ -81,8 +77,8 @@ function maybeAnimate(isEnabled: boolean) { export const Loader: FC = (props) => (