Skip to content

Commit

Permalink
moref ixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 21, 2024
1 parent d42e67c commit 1233166
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export default function SignInCard() {
<Divider>or</Divider>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Google')}
Expand All @@ -186,7 +185,6 @@ export default function SignInCard() {
Sign in with Google
</Button>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Facebook')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export default function SignInCard() {
<Divider>or</Divider>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Google')}
Expand All @@ -186,7 +185,6 @@ export default function SignInCard() {
Sign in with Google
</Button>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Facebook')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function SignInSide() {
sx={{
justifyContent: 'center',
gap: { xs: 6, sm: 12 },
p: 2,
p: '40px',
m: 'auto',
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function SignInSide() {
sx={{
justifyContent: 'center',
gap: { xs: 6, sm: 12 },
p: 2,
p: '40px',
m: 'auto',
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export default function SignIn(props) {
<Divider>or</Divider>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Google')}
Expand All @@ -220,7 +219,6 @@ export default function SignIn(props) {
Sign in with Google
</Button>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Facebook')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export default function SignIn(props: { disableCustomTheme?: boolean }) {
<Divider>or</Divider>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Google')}
Expand All @@ -220,7 +219,6 @@ export default function SignIn(props: { disableCustomTheme?: boolean }) {
Sign in with Google
</Button>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign in with Facebook')}
Expand Down
12 changes: 7 additions & 5 deletions docs/data/material/getting-started/templates/sign-up/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ export default function SignUp() {
const [showCustomTheme, setShowCustomTheme] = React.useState(true);
const defaultTheme = createTheme({ palette: { mode } });
const SignUpTheme = createTheme(getSignUpTheme(mode));
const [nameError, setNameError] = React.useState(false);
const [nameErrorMessage, setNameErrorMessage] = React.useState('');
const [emailError, setEmailError] = React.useState(false);
const [emailErrorMessage, setEmailErrorMessage] = React.useState('');
const [passwordError, setPasswordError] = React.useState(false);
const [passwordErrorMessage, setPasswordErrorMessage] = React.useState('');
const [nameError, setNameError] = React.useState(false);
const [nameErrorMessage, setNameErrorMessage] = React.useState('');
// This code only runs on the client side, to determine the system color preference
React.useEffect(() => {
// Check if there is a preferred mode in localStorage
Expand Down Expand Up @@ -122,7 +122,10 @@ export default function SignUp() {
};

const handleSubmit = (event) => {
event.preventDefault();
if (nameError || emailError || passwordError) {
event.preventDefault();
return;
}
const data = new FormData(event.currentTarget);
console.log({
name: data.get('name'),
Expand Down Expand Up @@ -160,6 +163,7 @@ export default function SignUp() {
</Typography>
<Box
component="form"
method="POST"
onSubmit={handleSubmit}
sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}
>
Expand Down Expand Up @@ -238,7 +242,6 @@ export default function SignUp() {
</Divider>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign up with Google')}
Expand All @@ -247,7 +250,6 @@ export default function SignUp() {
Sign up with Google
</Button>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign up with Facebook')}
Expand Down
12 changes: 7 additions & 5 deletions docs/data/material/getting-started/templates/sign-up/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export default function SignUp() {
const [showCustomTheme, setShowCustomTheme] = React.useState(true);
const defaultTheme = createTheme({ palette: { mode } });
const SignUpTheme = createTheme(getSignUpTheme(mode));
const [nameError, setNameError] = React.useState(false);
const [nameErrorMessage, setNameErrorMessage] = React.useState('');
const [emailError, setEmailError] = React.useState(false);
const [emailErrorMessage, setEmailErrorMessage] = React.useState('');
const [passwordError, setPasswordError] = React.useState(false);
const [passwordErrorMessage, setPasswordErrorMessage] = React.useState('');
const [nameError, setNameError] = React.useState(false);
const [nameErrorMessage, setNameErrorMessage] = React.useState('');
// This code only runs on the client side, to determine the system color preference
React.useEffect(() => {
// Check if there is a preferred mode in localStorage
Expand Down Expand Up @@ -127,7 +127,10 @@ export default function SignUp() {
};

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (nameError || emailError || passwordError) {
event.preventDefault();
return;
}
const data = new FormData(event.currentTarget);
console.log({
name: data.get('name'),
Expand Down Expand Up @@ -166,6 +169,7 @@ export default function SignUp() {
</Typography>
<Box
component="form"
method="POST"
onSubmit={handleSubmit}
sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}
>
Expand Down Expand Up @@ -244,7 +248,6 @@ export default function SignUp() {
</Divider>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign up with Google')}
Expand All @@ -253,7 +256,6 @@ export default function SignUp() {
Sign up with Google
</Button>
<Button
type="submit"
fullWidth
variant="outlined"
onClick={() => alert('Sign up with Facebook')}
Expand Down

0 comments on commit 1233166

Please sign in to comment.