-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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] Revise and expand Joy UI "Tutorial" doc #34569
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dc0340c
intro and prereqs
samuelsycamore e83a975
revise headers
samuelsycamore eed27e2
revisions thru text field
samuelsycamore 5fd31a8
second draft thru text field
samuelsycamore 46639c2
button and link revisions
samuelsycamore bb48ab2
login page demo
samuelsycamore 3e21538
light dark more section
samuelsycamore 020fd87
final sections
samuelsycamore File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import * as React from 'react'; | ||
import { CssVarsProvider, useColorScheme } from '@mui/joy/styles'; | ||
import Sheet from '@mui/joy/Sheet'; | ||
import Typography from '@mui/joy/Typography'; | ||
import TextField from '@mui/joy/TextField'; | ||
import Button from '@mui/joy/Button'; | ||
import Link from '@mui/joy/Link'; | ||
|
||
const ModeToggle = () => { | ||
const { mode, setMode } = useColorScheme(); | ||
const [mounted, setMounted] = React.useState(false); | ||
|
||
// necessary for server-side rendering | ||
// because mode is undefined on the server | ||
React.useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
if (!mounted) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Button | ||
variant="outlined" | ||
onClick={() => { | ||
if (mode === 'light') { | ||
setMode('dark'); | ||
} else { | ||
setMode('light'); | ||
} | ||
}} | ||
> | ||
{mode === 'light' ? 'Turn dark' : 'Turn light'} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default function App() { | ||
return ( | ||
<CssVarsProvider> | ||
<main> | ||
<ModeToggle /> | ||
<Sheet | ||
sx={{ | ||
maxWidth: 400, | ||
mx: 'auto', // margin left & right | ||
my: 4, // margin top & botom | ||
py: 3, // padding top & bottom | ||
px: 2, // padding left & right | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 2, | ||
borderRadius: 'sm', | ||
boxShadow: 'md', | ||
}} | ||
variant="outlined" | ||
> | ||
<div> | ||
<Typography level="h4" component="h1"> | ||
<b>Welcome!</b> | ||
</Typography> | ||
<Typography level="body2">Sign in to continue.</Typography> | ||
</div> | ||
<TextField | ||
// html input attribute | ||
name="email" | ||
type="email" | ||
placeholder="johndoe@email.com" | ||
// pass down to FormLabel as children | ||
label="Email" | ||
/> | ||
<TextField | ||
name="password" | ||
type="password" | ||
placeholder="password" | ||
label="Password" | ||
/> | ||
<Button | ||
sx={{ | ||
mt: 1, // margin top | ||
}} | ||
> | ||
Log in | ||
</Button> | ||
<Typography | ||
endDecorator={<Link href="/sign-up">Sign up</Link>} | ||
fontSize="sm" | ||
sx={{ alignSelf: 'center' }} | ||
> | ||
Don't have an account? | ||
</Typography> | ||
</Sheet> | ||
</main> | ||
</CssVarsProvider> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This h1 in the page could confuse Google when indexing this page of the docs https://app.ahrefs.com/site-audit/3524616/33/data-explorer?columns=pageRating%2Curl%2Ctraffic%2ChttpCode%2Cdepth%2Ch1%2Ch1Length%2CnrH1%2Ccompliant&filterCollapsed=true&filterId=377676a0df737bc09d40ffe8c8f9e699&issueId=c64d52ef-d0f4-11e7-8ed1-001e67ed4656.
I think that it would be idea to use the
iframe
option, e.g. this demo: https://mui.com/material-ui/react-app-bar/#back-to-top