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

[SignInPage] Revamp slots #4574

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

bharatkashyap
Copy link
Member

@bharatkashyap bharatkashyap commented Dec 30, 2024

New Slots Layout

Screenshot 2025-01-14 at 11 56 17 PM

Excalidraw

Breaking Change

  • Remove rememberMe
  • Remove the forgotPasswordLink and signUpLink slots
  • Remove the default remember me checkbox

Other Changes

@mui-bot
Copy link

mui-bot commented Dec 30, 2024

Netlify deploy preview

https://deploy-preview-4574--mui-toolpad-docs.netlify.app/

Generated by 🚫 dangerJS against b28a2b1

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 6, 2025
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 7, 2025
@bharatkashyap bharatkashyap changed the title [SignInPage] Make rememberMe optional, add form slotProp [SignInPage] Make rememberMe optional Jan 7, 2025
@bharatkashyap bharatkashyap changed the title [SignInPage] Make rememberMe optional [SignInPage] [breaking] Rename rememberMe slot to checkbox Jan 7, 2025
@bharatkashyap bharatkashyap changed the title [SignInPage] [breaking] Rename rememberMe slot to checkbox [SignInPage] Rename rememberMe slot to checkbox Jan 7, 2025
Copy link
Member

@apedroferreira apedroferreira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a look and left some comments!
Overall the idea of the "remember me" slot being more generic and optional with its own component seems good to me.

emailField: { variant: 'standard', autoFocus: false },
passwordField: { variant: 'standard' },
submitButton: { variant: 'outlined' },
rememberMe: {
checkbox: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkbox is more generic than rememberMe so I think it's an improvement, but could we make it more generic even as any type of content could go in this slot, such as a small disclaimer for example, or multiple checkboxes?
Not sure if something like formFooter would be a good name...
Anyway these are just some thoughts!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I see we have a forgotPasswordLink slot too, so if when implementing these you saw that there's a benefit to these slots being more specific then it should be fine.

Copy link
Member Author

@bharatkashyap bharatkashyap Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, formFooter makes more sense!

Agreed, I did feel thatforgotPasswordLink and signUpLink seem hyper-specific. If we're offering the entire formFooter area as a slot, perhaps it makes sense to remove forgotPasswordLink entirely with this PR? If someone wants a forgot password link, they can simply add it in their slot component.

I would propose removing forgotPasswordLink, rememberMe and signUpLink to create this structure (including a new form slot to override the entire form):

Screenshot 2025-01-09 at 5 53 28 PM

Wdyt? Also @Janpot and @prakhargupta1

Might make sense to move this to the next release and mark that as having a lot of breaking changes for the SignInPage slots

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving those to "plug-in" components seems good to me if they're complex enough!

@@ -16,17 +16,19 @@ export default function SlotPropsSignIn() {
`Signing in with "${provider.name}" and credentials: ${formData.get('email')}, ${formData.get('password')} and checkbox value: ${formData.get('tandc')}`,
)
}
slots={{ checkbox: RememberCheckbox }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about RememberMeCheckbox, would it be just a bit more descriptive?

@@ -18,10 +18,10 @@
},
"classDescriptions": {},
"slotDescriptions": {
"checkbox": "A custom checkbox placed in the credentials form",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the name as I proposed we'd have to update the description to something more generic too.

color: 'textSecondary',
fontSize: theme.typography.pxToRem(14),
},
...props?.slotProps?.typography,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just spread this inside typography instead?

import { FormControlLabel, Checkbox } from '@mui/material';
import { useTheme } from '@mui/material/styles';

interface RememberCheckboxProps {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just allow all slotProps from FormControlLabel and make sure they're passed to the component?

@bharatkashyap bharatkashyap changed the title [SignInPage] Rename rememberMe slot to checkbox [SignInPage] Revamp slots Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants