From b0d68becfec433a0ab46942aa9e578f4499b92f6 Mon Sep 17 00:00:00 2001 From: Nathan Vasse Date: Tue, 26 Sep 2023 11:41:55 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(react)=20update=20stories=20?= =?UTF-8?q?for=20themes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stories do not need CunninghamProvider anymore since it is handled by the configuration for the themes support. Some stories were also using wrong colors that didn't handle multiple themes. --- .../src/components/DataGrid/index.stories.tsx | 241 ++++---- .../Forms/Checkbox/index.stories.tsx | 6 +- .../Forms/DatePicker/index.stories.tsx | 120 ++-- .../Examples/ReactHookForm/Sports.stories.tsx | 213 ++++--- .../Forms/Examples/index.stories.tsx | 520 +++++++++--------- .../Forms/FileUploader/index.stories.tsx | 94 ++-- .../components/Forms/Input/index.stories.tsx | 2 +- .../components/Forms/Select/mono.stories.tsx | 349 ++++++------ .../components/Forms/Select/multi.stories.tsx | 309 +++++------ .../components/Forms/Switch/index.stories.tsx | 4 +- .../components/Pagination/index.stories.tsx | 31 +- 11 files changed, 902 insertions(+), 987 deletions(-) diff --git a/packages/react/src/components/DataGrid/index.stories.tsx b/packages/react/src/components/DataGrid/index.stories.tsx index c51f86e..0c16d92 100644 --- a/packages/react/src/components/DataGrid/index.stories.tsx +++ b/packages/react/src/components/DataGrid/index.stories.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useMemo, useState } from "react"; import { faker } from "@faker-js/faker"; import { DataGrid, SortModel } from ":/components/DataGrid/index"; import { usePagination } from ":/components/Pagination"; -import { CunninghamProvider } from ":/components/Provider"; import { Button } from ":/components/Button"; import { SimpleDataGrid } from ":/components/DataGrid/SimpleDataGrid"; import { DataList } from ":/components/DataGrid/DataList"; @@ -15,36 +14,32 @@ export default { export const Empty = () => { return ( - - - + ); }; export const Loading = () => { return ( - - - + ); }; @@ -61,43 +56,41 @@ export const ClientSideWithoutPagination = () => { [], ); return ( - - ( - - ); - }, + { + return ( + + ); }, - ]} - /> - + }, + ]} + /> ); }; diff --git a/packages/react/src/components/Forms/Checkbox/index.stories.tsx b/packages/react/src/components/Forms/Checkbox/index.stories.tsx index ff8a2f2..d5002b1 100644 --- a/packages/react/src/components/Forms/Checkbox/index.stories.tsx +++ b/packages/react/src/components/Forms/Checkbox/index.stories.tsx @@ -122,7 +122,7 @@ export const Success = { export const Group = () => (
-
Your offices
+
Your offices
@@ -135,7 +135,7 @@ export const Group = () => ( export const GroupError = () => (
-
Your offices
+
Your offices
@@ -148,7 +148,7 @@ export const GroupError = () => ( export const GroupSuccess = () => (
-
Your offices
+
Your offices
diff --git a/packages/react/src/components/Forms/DatePicker/index.stories.tsx b/packages/react/src/components/Forms/DatePicker/index.stories.tsx index 5520852..10fd693 100644 --- a/packages/react/src/components/Forms/DatePicker/index.stories.tsx +++ b/packages/react/src/components/Forms/DatePicker/index.stories.tsx @@ -16,16 +16,12 @@ export default { } as Meta; const Template: StoryFn = (args) => ( - - - + ); export const Default = () => (
- - - +
); @@ -98,13 +94,11 @@ export const Fullwidth = { export const CustomLocale = () => (
- - - +
); @@ -122,21 +116,19 @@ export const CunninghamLocale = () => ( export const Controlled = () => { const [value, setValue] = useState("2023-04-25T12:00:00.000Z"); return ( - -
-
- Value: {value?.toString()} -
- { - setValue(e); - }} - /> - +
+
+ Value: {value?.toString()}
- + { + setValue(e); + }} + /> + +
); }; @@ -153,47 +145,41 @@ export const ReactHookForm = () => { }); return ( - - -
- - - -
-
+ +
+ + + +
); }; export const RangeDefault = () => { return (
- - - +
); }; export const RangeDefaultValue = () => { return ( - - - + ); }; @@ -204,18 +190,16 @@ export const RangeControlled = () => { ]); return (
- -
Value: {value?.join(" ")}
- setValue(e)} - /> - -
+
Value: {value?.join(" ")}
+ setValue(e)} + /> +
); }; diff --git a/packages/react/src/components/Forms/Examples/ReactHookForm/Sports.stories.tsx b/packages/react/src/components/Forms/Examples/ReactHookForm/Sports.stories.tsx index 7b1b4a7..9208e7b 100644 --- a/packages/react/src/components/Forms/Examples/ReactHookForm/Sports.stories.tsx +++ b/packages/react/src/components/Forms/Examples/ReactHookForm/Sports.stories.tsx @@ -5,7 +5,6 @@ import { useForm, FormProvider } from "react-hook-form"; import * as Yup from "yup"; import { RhfInput } from ":/components/Forms/Input/stories-utils"; import { Button } from ":/components/Button"; -import { CunninghamProvider } from ":/components/Provider"; import { Radio, RadioGroup } from ":/components/Forms/Radio"; import { RhfSelect } from ":/components/Forms/Select/stories-utils"; import { @@ -55,119 +54,117 @@ const SportsBase = ({ values }: SportProps) => { }, [values]); return ( - - -
+ +

-

- Register -

+ Register + -
-
Gender
- +
Gender
+ + - - - - -
-
- - -
+ + +
+
+ + +
- - - - - Need help ? - - - -
+ + + + + Need help ? + + + ); }; diff --git a/packages/react/src/components/Forms/Examples/index.stories.tsx b/packages/react/src/components/Forms/Examples/index.stories.tsx index 3d85297..c739b3b 100644 --- a/packages/react/src/components/Forms/Examples/index.stories.tsx +++ b/packages/react/src/components/Forms/Examples/index.stories.tsx @@ -5,7 +5,6 @@ import { Input } from ":/components/Forms/Input"; import { Checkbox } from ":/components/Forms/Checkbox"; import { Button } from ":/components/Button"; import { Select } from ":/components/Forms/Select"; -import { CunninghamProvider } from ":/components/Provider"; import { FileUploader } from ":/components/Forms/FileUploader"; import { Switch } from ":/components/Forms/Switch"; import { Radio } from ":/components/Forms/Radio"; @@ -55,291 +54,276 @@ export const Login = () => { export const Application = () => { return ( - -
+

-

- Application -

- +
+ + +
+ +
+
+ +
+ +
+
+
Your curriculum vitae
+ -
- - -
- -
-
- -
- -
-
-
- Your curriculum vitae -
- -
-
- - -
- - - - Need help ? - - - +
+
+ + +
+ + + + Need help ? + + ); }; export const Sports = () => { return ( - -
e.preventDefault()} + > +

-

- Register -

-
-
Gender
-
- - - -
-
-
- - + Register + +
+
Gender
+
+ + +
+
+
+ + +
- - - - - - Need help ? - - - + + + + + + Need help ? + + ); }; export const SportsDisabled = () => { const [withValues, setWithValues] = useState(false); return ( - -
+

-

- Register -

-
-
Gender
-
- - - -
-
-
- - + Register + +
+
Gender
+
+ + +
+
+
+ + +
- - - - setWithValues(e.target.checked)} - /> - - - Need help ? - - - + + + + setWithValues(e.target.checked)} + /> + + + Need help ? + + ); }; diff --git a/packages/react/src/components/Forms/FileUploader/index.stories.tsx b/packages/react/src/components/Forms/FileUploader/index.stories.tsx index 24b72c7..5f4ba63 100644 --- a/packages/react/src/components/Forms/FileUploader/index.stories.tsx +++ b/packages/react/src/components/Forms/FileUploader/index.stories.tsx @@ -1,19 +1,12 @@ -import { Meta, StoryFn } from "@storybook/react"; +import { Meta } from "@storybook/react"; import React, { useEffect, useRef, useState } from "react"; import { faker } from "@faker-js/faker"; import { FileUploader, FileUploaderRefType, } from ":/components/Forms/FileUploader/index"; -import { CunninghamProvider } from ":/components/Provider"; import { Button } from ":/components/Button"; -const Template: StoryFn = (args) => ( - - - -); - const FAKE_FILES = [ new File(["42"], faker.lorem.sentence(5) + "pdf"), new File(["42"], faker.lorem.sentence(1) + "pdf"), @@ -24,7 +17,6 @@ const FAKE_FILES = [ const meta: Meta = { title: "Components/Forms/FileUploader", component: FileUploader, - render: Template, }; export default meta; @@ -146,7 +138,7 @@ export const MonoStatesShowcase = { // the fake default files. In all other step we want it to be persistant in order to see transitions ( like the // border color ). return ( -