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] Polish Sign in to your account joy demo #37498

Merged
merged 3 commits into from
Jun 11, 2023

Conversation

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy labels Jun 4, 2023
@@ -40,6 +40,7 @@ function ColorSchemeToggle({ onClick, ...props }: IconButtonProps) {
size="sm"
variant="plain"
color="neutral"
aria-label="toggle light/dark mode"
Copy link
Member Author

@oliviertassinari oliviertassinari Jun 4, 2023

Choose a reason for hiding this comment

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

Comment on lines -162 to 168
<Typography component="h2" fontSize="xl2" fontWeight="lg">
Welcome back
<Typography component="h1" fontSize="xl2" fontWeight="lg">
Sign in to your account
</Typography>
<Typography level="body2" sx={{ my: 1, mb: 3 }}>
Let&apos;s get started! Please enter your details.
Welcome back
</Typography>
Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't understand the previous wording.

@@ -234,10 +235,10 @@ export default function JoySignInSideTemplate() {
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
backgroundImage:
'url(https://images.unsplash.com/photo-1527181152855-fc03fc7949c8)',
'url(https://images.unsplash.com/photo-1527181152855-fc03fc7949c8?auto=format&w=1000&dpr=2)',
Copy link
Member Author

@oliviertassinari oliviertassinari Jun 4, 2023

Choose a reason for hiding this comment

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

Comment on lines -183 to +188
<Input placeholder="Enter your email" type="email" name="email" />
<Input type="email" name="email" />
</FormControl>
<FormControl required>
<FormLabel>Password</FormLabel>
<Input placeholder="•••••••" type="password" name="password" />
<Input type="password" name="password" />
Copy link
Member Author

@oliviertassinari oliviertassinari Jun 4, 2023

Choose a reason for hiding this comment

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

These placeholders feel confusing. I can't find a serious benchmark that has them. (Stripe, Figma). I suspect it's because it can be confused with the value being already filled (at least how it feels on my end.

@mui-bot
Copy link

mui-bot commented Jun 4, 2023

Netlify deploy preview

https://deploy-preview-37498--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against 5e4435a

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jun 4, 2023

Something is broken with:

    <CssVarsProvider
      defaultMode="dark"
      disableTransitionOnChange
      theme={customTheme}
    >

it flashes between the light and dark mode when I load the page. It can be reproduced in https://pagespeed.web.dev/analysis/https-deploy-preview-37498--material-ui-netlify-app-joy-ui-getting-started-templates-sign-in-side/x9knl6jsq2?form_factor=mobile

Screenshot 2023-06-05 at 17 43 11

A single render would likely already improve the lighthouse performance score.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement!

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jun 5, 2023

@siriwatknp Anyone idea on what's going on with #37498 (comment)? This makes the template not truly usable in production (the most exigent users won't, e.g. I would either fix this or not use it if I was a user, 49/100: no thanks, let's try the next UI library).

@siriwatknp
Copy link
Member

@siriwatknp Anyone idea on what's going on with #37498 (comment)? This makes the template not truly usable in production (the most exigent users won't, e.g. I would either fix this or not use it if I was a user, 49/100: no thanks, let's try the next UI library).

Since the templates live in the structure of the docs, I don't think it is fair to run the lighthouse against them. The page is not 100% Joy UI, it includes MUI branding theme at the top and that's a separate issue to fix.

FYI, Joy UI has a lot of room for performance improvement but it requires discussion about the approach we want to go with.

@siriwatknp
Copy link
Member

Anyone idea on what's going on with #37498 (comment)?

This is because the defaultMode of this page is set to dark but the value defined in getInitColorSchemeScript is system (see docs/pages/_document.js). It creates inconsistent behavior for the first visit.

I have changed defaultMode of this page to system. Please try again (you have to clear the local storage first).

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jun 11, 2023

Since the templates live in the structure of the docs, I don't think it is fair to run the lighthouse against them.

@siriwatknp My expectation is that developer will run it, and not care what's the context, only remember that score is X.

I have changed defaultMode of this page to system.

The lighthouse score is clearly better: https://pagespeed.web.dev/analysis/https-deploy-preview-37498--material-ui-netlify-app-joy-ui-getting-started-templates-sign-in-side/k0gtkyl01a?form_factor=mobile. Not almost 100% like https://www.builder.io/ has on a heavy page, but a step better 👍:

Screenshot 2023-06-12 at 01 42 07

Please try again (you have to clear the local storage first).

This is broken for me, in a different way. The different templates don't handle correctly when mode = 'system'

const { mode, setMode } = useColorScheme();

Some template displays two logos, others make you press the button twice: system (light) => light => dark.

Screenshot 2023-06-12 at 01 48 33

I have reverted the last commit. I think it goes in the right direction, only it introduce regressions, I would like to merge these changes: one step at a time.


This is because the defaultMode of this page is set to dark but the value defined in getInitColorSchemeScript is system (see docs/pages/_document.js). It creates inconsistent behavior for the first visit.

Oh I see, very interesting. A few thoughts:

  1. Would it make sense for getInitColorSchemeScript() to set a window variable with the resolved mode that it uses? This way, CssVarsProvider know to ignore the value of defaultMode if we are in a SSR context.
  2. I can't find clear docs about CssVarsProvider API reference, the only place is in Material UI but this seems unrelated to Joy UI (I imagine as a developer). I had to dive into the source to figure stuff out (what's is each prop for).
  3. We probably when to update https://mui.com/joy-ui/getting-started/tutorial/ to make system by default as a first-class use case. I understand why light is the default mode, as developers might not have set their app to be dark compatible, but as soon as they do, system seems to be what makes the most sense, everywhere.

@oliviertassinari oliviertassinari enabled auto-merge (squash) June 11, 2023 23:50
@oliviertassinari oliviertassinari merged commit 90d9d13 into mui:master Jun 11, 2023
@oliviertassinari oliviertassinari deleted the joy-broken-h1 branch June 12, 2023 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants