Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Fix Sign-in template form experience #43838

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -126,6 +129,7 @@ export default function SignInCard() {
<FormLabel htmlFor="password">Password</FormLabel>
<Link
component="button"
type="button"
onClick={handleClickOpen}
variant="body2"
sx={{ alignSelf: 'baseline' }}
Expand Down Expand Up @@ -172,7 +176,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 @@ -181,7 +184,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 @@ -50,7 +50,10 @@ export default function SignInCard() {
};

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (emailError || passwordError) {
event.preventDefault();
return;
}
const data = new FormData(event.currentTarget);
console.log({
email: data.get('email'),
Expand Down Expand Up @@ -126,6 +129,7 @@ export default function SignInCard() {
<FormLabel htmlFor="password">Password</FormLabel>
<Link
component="button"
type="button"
onClick={handleClickOpen}
variant="body2"
sx={{ alignSelf: 'baseline' }}
Expand Down Expand Up @@ -172,7 +176,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 @@ -181,7 +184,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: { xs: 2, sm: 4 },
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: { xs: 2, sm: 4 },
m: 'auto',
}}
>
Expand Down
15 changes: 10 additions & 5 deletions docs/data/material/getting-started/templates/sign-in/SignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ const Card = styled(MuiCard)(({ theme }) => ({
}));

const SignInContainer = styled(Stack)(({ theme }) => ({
padding: 20,
marginTop: '10vh',
minHeight: '100%',
padding: theme.spacing(2),
[theme.breakpoints.up('sm')]: {
padding: theme.spacing(4),
},
'&::before': {
content: '""',
display: 'block',
Expand Down Expand Up @@ -72,7 +75,10 @@ export default function SignIn(props) {
};

const handleSubmit = (event) => {
event.preventDefault();
if (emailError || passwordError) {
event.preventDefault();
return;
}
const data = new FormData(event.currentTarget);
console.log({
email: data.get('email'),
Expand Down Expand Up @@ -155,6 +161,7 @@ export default function SignIn(props) {
<FormLabel htmlFor="password">Password</FormLabel>
<Link
component="button"
type="button"
onClick={handleClickOpen}
variant="body2"
sx={{ alignSelf: 'baseline' }}
Expand Down Expand Up @@ -206,7 +213,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 @@ -215,7 +221,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
15 changes: 10 additions & 5 deletions docs/data/material/getting-started/templates/sign-in/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ const Card = styled(MuiCard)(({ theme }) => ({
}));

const SignInContainer = styled(Stack)(({ theme }) => ({
padding: 20,
marginTop: '10vh',
minHeight: '100%',
padding: theme.spacing(2),
[theme.breakpoints.up('sm')]: {
padding: theme.spacing(4),
},
'&::before': {
content: '""',
display: 'block',
Expand Down Expand Up @@ -72,7 +75,10 @@ export default function SignIn(props: { disableCustomTheme?: boolean }) {
};

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (emailError || passwordError) {
event.preventDefault();
return;
}
const data = new FormData(event.currentTarget);
console.log({
email: data.get('email'),
Expand Down Expand Up @@ -155,6 +161,7 @@ export default function SignIn(props: { disableCustomTheme?: boolean }) {
<FormLabel htmlFor="password">Password</FormLabel>
<Link
component="button"
type="button"
onClick={handleClickOpen}
variant="body2"
sx={{ alignSelf: 'baseline' }}
Expand Down Expand Up @@ -206,7 +213,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 @@ -215,7 +221,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
Loading