diff --git a/look-and-feel/css/src/Loader/Loader.scss b/look-and-feel/css/src/Loader/Loader.scss index f08f21a15..07cebbcba 100644 --- a/look-and-feel/css/src/Loader/Loader.scss +++ b/look-and-feel/css/src/Loader/Loader.scss @@ -10,6 +10,21 @@ align-items: center; justify-content: center; animation: spin 2s linear infinite; + + &--blue { + border: solid color-mix(in srgb, var(--color-axa), transparent 80%); + border-top: solid var(--color-axa); + } + + &--gray { + border: solid color-mix(in srgb, var(--color-gray), transparent 80%); + border-top: solid var(--color-gray); + } + + &--white { + border: solid color-mix(in srgb, var(--color-white), transparent 80%); + border-top: solid var(--color-white); + } } } diff --git a/look-and-feel/react/src/Loader/Loader.mdx b/look-and-feel/react/src/Loader/Loader.mdx new file mode 100644 index 000000000..55ffb23df --- /dev/null +++ b/look-and-feel/react/src/Loader/Loader.mdx @@ -0,0 +1,32 @@ +import { Canvas, Controls, Meta } from "@storybook/addon-docs"; +import * as LoaderStories from "./Loader.stories"; + + + +# Loader + +To use the loader import it like that: + +```tsx title="test.js" +import { Loader } from "@axa-fr/design-system-look-and-feel-react"; + +const MyComponent = () => ( + +); +``` + +## Playground + + + + + +## Variants + +Use the `variant` prop to change the look of the loader. The available variants are `"blue"` (default), `"gray"` and `"white"`. [See the examples](#examples-of-variants). + +## Examples of variants + + + +For more information regarding the use of this component, you can refer to [the documentation and guidelines](https://zeroheight.com/54c5bd254/v/latest/p/892d26-spinner/b/44fc87) written by our UX and UI designers. diff --git a/look-and-feel/react/src/Loader/Loader.stories.tsx b/look-and-feel/react/src/Loader/Loader.stories.tsx index 3cf08da04..16da6ac1e 100644 --- a/look-and-feel/react/src/Loader/Loader.stories.tsx +++ b/look-and-feel/react/src/Loader/Loader.stories.tsx @@ -18,3 +18,44 @@ export const LoaderStory: Story = { border: 5, }, }; + +export const LoaderGrayStory: Story = { + name: "Loader gray", + render: ({ ...args }) => , + args: { + size: 60, + border: 5, + variant: "gray", + }, +}; + +export const LoaderWhiteStory: Story = { + name: "Loader white", + render: ({ ...args }) => , + args: { + size: 60, + border: 5, + variant: "white", + }, +}; + +export const MultiExamples: StoryObj = { + name: "Loader examples", + render: () => ( +
+ + + +
+ ), +}; diff --git a/look-and-feel/react/src/Loader/Loader.tsx b/look-and-feel/react/src/Loader/Loader.tsx index 4f46be65e..775c40e9e 100644 --- a/look-and-feel/react/src/Loader/Loader.tsx +++ b/look-and-feel/react/src/Loader/Loader.tsx @@ -1,14 +1,17 @@ import "@axa-fr/design-system-look-and-feel-css/dist/Loader/Loader.scss"; +import classNames from "classnames"; type LoaderProps = { border?: number; size?: number; + variant?: "blue" | "gray" | "white"; text?: string; }; const Loader = ({ border = 5, size = 60, + variant = "blue", text = "Chargement en cours", }: LoaderProps) => (