From 9518624fdbe63b75f12b74f32f8d35c0cc051fce Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 21 Sep 2024 19:17:35 +0200 Subject: [PATCH 1/4] [docs] Fix Sign-in template form experience --- .../getting-started/templates/sign-in-side/SignInCard.js | 1 + .../getting-started/templates/sign-in-side/SignInCard.tsx | 1 + docs/data/material/getting-started/templates/sign-in/SignIn.js | 1 + docs/data/material/getting-started/templates/sign-in/SignIn.tsx | 1 + 4 files changed, 4 insertions(+) diff --git a/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js b/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js index 57d293c0490a54..bcc41e10ffabc1 100644 --- a/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js +++ b/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js @@ -126,6 +126,7 @@ export default function SignInCard() { Password Password Password Password Date: Sat, 21 Sep 2024 19:30:22 +0200 Subject: [PATCH 2/4] summit the form as well to show it works --- .../getting-started/templates/sign-in-side/SignInCard.js | 6 +++++- .../getting-started/templates/sign-in-side/SignInCard.tsx | 6 +++++- .../material/getting-started/templates/sign-in/SignIn.js | 6 +++++- .../material/getting-started/templates/sign-in/SignIn.tsx | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js b/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js index bcc41e10ffabc1..a6af7cffd45ed0 100644 --- a/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js +++ b/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js @@ -50,7 +50,10 @@ export default function SignInCard() { }; const handleSubmit = (event) => { - event.preventDefault(); + if (emailError || passwordError) { + event.preventDefault(); + return; + } const data = new FormData(event.currentTarget); console.log({ email: data.get('email'), @@ -99,6 +102,7 @@ export default function SignInCard() { ) => { - event.preventDefault(); + if (emailError || passwordError) { + event.preventDefault(); + return; + } const data = new FormData(event.currentTarget); console.log({ email: data.get('email'), @@ -99,6 +102,7 @@ export default function SignInCard() { { - event.preventDefault(); + if (emailError || passwordError) { + event.preventDefault(); + return; + } const data = new FormData(event.currentTarget); console.log({ email: data.get('email'), @@ -123,6 +126,7 @@ export default function SignIn(props) { ) => { - event.preventDefault(); + if (emailError || passwordError) { + event.preventDefault(); + return; + } const data = new FormData(event.currentTarget); console.log({ email: data.get('email'), @@ -123,6 +126,7 @@ export default function SignIn(props: { disableCustomTheme?: boolean }) { Date: Sat, 21 Sep 2024 21:35:21 +0200 Subject: [PATCH 3/4] moref ixes --- .../templates/sign-in-side/SignInCard.js | 2 -- .../templates/sign-in-side/SignInCard.tsx | 2 -- .../templates/sign-in-side/SignInSide.js | 2 +- .../templates/sign-in-side/SignInSide.tsx | 2 +- .../getting-started/templates/sign-in/SignIn.js | 2 -- .../getting-started/templates/sign-in/SignIn.tsx | 2 -- .../getting-started/templates/sign-up/SignUp.js | 12 +++++++----- .../getting-started/templates/sign-up/SignUp.tsx | 12 +++++++----- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js b/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js index a6af7cffd45ed0..7407bd950d6d34 100644 --- a/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js +++ b/docs/data/material/getting-started/templates/sign-in-side/SignInCard.js @@ -177,7 +177,6 @@ export default function SignInCard() { or - - Already have an account?{' '} - - - Sign in - - - - - - or - - - - - - - + error={passwordError} + helperText={passwordErrorMessage} + color={passwordError ? 'error' : 'primary'} + /> + + } + label="I want to receive updates via email." + /> + + + Already have an account?{' '} + + + Sign in + + + + + + or + + + + + + diff --git a/docs/data/material/getting-started/templates/sign-up/SignUp.tsx b/docs/data/material/getting-started/templates/sign-up/SignUp.tsx index a76924cfbbf0fb..a375bae9d1f15f 100644 --- a/docs/data/material/getting-started/templates/sign-up/SignUp.tsx +++ b/docs/data/material/getting-started/templates/sign-up/SignUp.tsx @@ -42,8 +42,11 @@ const Card = styled(MuiCard)(({ theme }) => ({ })); const SignUpContainer = styled(Stack)(({ theme }) => ({ - height: '100%', - padding: 4, + minHeight: '100%', + padding: theme.spacing(2), + [theme.breakpoints.up('sm')]: { + padding: theme.spacing(4), + }, backgroundImage: 'radial-gradient(ellipse at 50% 50%, hsl(210, 100%, 97%), hsl(0, 0%, 100%))', backgroundRepeat: 'no-repeat', @@ -149,123 +152,113 @@ export default function SignUp() { > - - - - - - Sign up - - - - Full name - - - - Email - - - - Password - - - } - label="I want to receive updates via email." - /> - - - Already have an account?{' '} - - - Sign in - - - - - - or - - - - - - - + error={passwordError} + helperText={passwordErrorMessage} + color={passwordError ? 'error' : 'primary'} + /> + + } + label="I want to receive updates via email." + /> + + + Already have an account?{' '} + + + Sign in + + + + + + or + + + + + +