From 8086a486720d8bd6fcaf99d8ff9e51a51f2f5723 Mon Sep 17 00:00:00 2001 From: Nathan Vasse Date: Mon, 11 Sep 2023 11:37:29 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D(react)=20improve=20form=20examples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We decided to improve the examples to fit better the guidelines of the design-system. --- .../Examples/ReactHookForm/Login.stories.tsx | 18 +++- .../Examples/ReactHookForm/Sports.stories.tsx | 54 ++++++----- .../Forms/Examples/index.stories.tsx | 95 +++++++++++++------ 3 files changed, 110 insertions(+), 57 deletions(-) diff --git a/packages/react/src/components/Forms/Examples/ReactHookForm/Login.stories.tsx b/packages/react/src/components/Forms/Examples/ReactHookForm/Login.stories.tsx index 7d40f60..3371587 100644 --- a/packages/react/src/components/Forms/Examples/ReactHookForm/Login.stories.tsx +++ b/packages/react/src/components/Forms/Examples/ReactHookForm/Login.stories.tsx @@ -46,7 +46,7 @@ export const Login = () => { display: "flex", flexDirection: "column", gap: "1rem", - width: "400px", + width: "300px", }} onSubmit={handleSubmit(onSubmit)} > @@ -54,10 +54,10 @@ export const Login = () => { className="fs-h3 fw-bold clr-greyscale-900" style={{ textAlign: "center" }} > - Please log-in! + Log in { label="Password" state={getFieldState("password", formState)} type="password" - text={getFieldErrorMessage("password", formState)} + text={ + getFieldErrorMessage("password", formState) || "Forgot your password?" + } fullWidth={true} {...register("password")} /> @@ -79,7 +81,13 @@ export const Login = () => { {...register("rememberMe")} /> - + +
+ You do not have an account?{" "} + + Register + +
); }; 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 f978833..4c8c3fe 100644 --- a/packages/react/src/components/Forms/Examples/ReactHookForm/Sports.stories.tsx +++ b/packages/react/src/components/Forms/Examples/ReactHookForm/Sports.stories.tsx @@ -64,6 +64,31 @@ export const Sports = () => { > Register + +
+
Gender
+ + + + + +
{ />
- - - - - { fullWidth={true} /> - + diff --git a/packages/react/src/components/Forms/Examples/index.stories.tsx b/packages/react/src/components/Forms/Examples/index.stories.tsx index d554789..3d85297 100644 --- a/packages/react/src/components/Forms/Examples/index.stories.tsx +++ b/packages/react/src/components/Forms/Examples/index.stories.tsx @@ -21,20 +21,20 @@ export const Login = () => { display: "flex", flexDirection: "column", gap: "1rem", - width: "400px", + width: "300px", }} >

- Please log-in! + Log in

- + {
- + +
+ You do not have an account?{" "} + + Register + +
); }; @@ -88,23 +94,35 @@ export const Application = () => { fullWidth={true} text="Only @acme.com domain is authorized" /> - - -
Your curriculum vitae
- +
+
+ +
+ +
+
+
+ Your curriculum vitae +
+ +
- + ); @@ -127,16 +145,19 @@ export const Sports = () => { > Register +
+
Gender
+
+ + + +
+
-
- - - -
{ -
- - - -
{ - + );