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] Rename rememberMe slot to checkbox #4574

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

Conversation

bharatkashyap
Copy link
Member

@bharatkashyap bharatkashyap commented Dec 30, 2024

Breaking Change

  • Rename rememberMe to checkbox to make the slot more generic
  • Remove the default checkbox in the component
  • Export a "RememberCheckbox" component to allow someone to pass it via the checkbox slot
import { SignInPage, RememberCheckbox } from "@toolpad/core/SignInPage";
// ...
<SignInPage
   slots={{checkbox: RememberCheckbox}}
   // ...
  />

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 fe77c05

@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.

@@ -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?

@@ -239,7 +239,7 @@ To enable deep customization beyond what is possible with custom props, the `Sig

{{"demo": "SlotsSignIn.js", "iframe": true, "height": 540 }}

You can use the `slotProps` prop to pass props to the underlying components of each slot:
You can use the `slotProps` prop to pass props to the underlying components of each slot, and also to `form` element:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
You can use the `slotProps` prop to pass props to the underlying components of each slot, and also to `form` element:
You can use the `slotProps` prop to pass props to the underlying components of each slot, and also to the `form` element:

@@ -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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an option for SignInPage to skip the stack with "Remember Me" and "Forgot Password"
3 participants