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

[joy-ui][docs] Add UI improvements to the side navigation demo #41461

Merged
merged 14 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
@@ -1,7 +1,7 @@
import * as React from 'react';

import Avatar from '@mui/joy/Avatar';
import Badge, { badgeClasses } from '@mui/joy/Badge';
import Badge from '@mui/joy/Badge';
import Box from '@mui/joy/Box';
import Card from '@mui/joy/Card';
import CardContent from '@mui/joy/CardContent';
Expand All @@ -16,6 +16,7 @@ import ListItemDecorator from '@mui/joy/ListItemDecorator';
import Typography from '@mui/joy/Typography';
import Select from '@mui/joy/Select';
import Option from '@mui/joy/Option';
import Stack from '@mui/joy/Stack';
import Sheet from '@mui/joy/Sheet';
import PieChart from '@mui/icons-material/PieChart';
import SmsIcon from '@mui/icons-material/Sms';
Expand All @@ -30,24 +31,23 @@ export default function ColorInversionNavigation() {
<Box sx={{ display: 'flex', borderRadius: 'sm', overflow: 'auto' }}>
<Sheet
variant="solid"
color="neutral"
invertedColors
sx={{
p: 2,
...(color !== 'neutral' && {
bgcolor: `${color}.800`,
bgcolor: `${color}.700`,
}),
}}
>
<Select
variant="outlined"
defaultValue="1"
variant="soft"
size="sm"
defaultValue="1"
placeholder={
<div>
<Typography level="inherit">Saleshouse</Typography>
<Stack alignItems="start">
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
<Typography level="title-lg">Saleshouse</Typography>
<Typography level="body-md">general team</Typography>
</div>
</Stack>
}
startDecorator={
<Sheet
Expand All @@ -62,7 +62,13 @@ export default function ColorInversionNavigation() {
<BubbleChartIcon sx={{ m: 0 }} />
</Sheet>
}
sx={{ py: 1 }}
color={color}
sx={{
py: 1,
bgcolor: 'transparent',
border: '1px solid',
borderColor: 'divider',
}}
>
<Option value="1">General team</Option>
<Option value="2">Engineering team</Option>
Expand All @@ -89,8 +95,8 @@ export default function ColorInversionNavigation() {
<Chip
data-skip-inverted-colors
size="sm"
color="warning"
variant="soft"
color={color}
sx={{ ml: 'auto' }}
>
5
Expand Down Expand Up @@ -131,28 +137,27 @@ export default function ColorInversionNavigation() {
</Card>
</Sheet>
<Sheet
variant="soft"
color="neutral"
variant="solid"
invertedColors
sx={(theme) => ({
sx={{
p: 2,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 2,
...(color !== 'neutral' && {
bgcolor: `${color}.900`,
}),
bgcolor: `${color}.900`,
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved

'& .MuiBadge-root': { '--Badge-ringColor': 'unset' },
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
'& .MuiBadge-colorSuccess': { bgcolor: 'success.400' },
'& button': {
borderRadius: '50%',
padding: 0,
'&:hover': {
boxShadow: theme.shadow.md,
},
'--IconButton-size': '3rem',
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
},
})}
}}
>
<Badge badgeContent="7" size="sm">
<IconButton>
<Badge badgeContent="7" badgeInset="15%" size="sm">
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
<IconButton size="lg">
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
<Avatar src="/static/images/avatar/3.jpg" />
</IconButton>
</Badge>
Expand All @@ -161,28 +166,27 @@ export default function ColorInversionNavigation() {
vertical: 'bottom',
horizontal: 'right',
}}
badgeInset="14%"
sx={{ [`& .${badgeClasses.badge}`]: { bgcolor: 'success.300' } }}
badgeInset="20%"
danilo-leal marked this conversation as resolved.
Show resolved Hide resolved
color="success"
>
<IconButton>
<IconButton size="lg">
<Avatar src="/static/images/avatar/4.jpg" />
</IconButton>
</Badge>
<IconButton variant="soft" aria-label="Add another chat">
<IconButton size="lg" aria-label="Add another chat">
<AddIcon />
</IconButton>
<IconButton
variant="plain"
size="sm"
size="lg"
onClick={() => {
const colors = ['primary', 'neutral', 'danger', 'success', 'warning'];

const nextColorIndex = colors.indexOf(color) + 1;
setColor(colors[nextColorIndex] ?? colors[0]);
}}
sx={{ mt: 'auto', height: '40px' }}
sx={{ mt: 'auto' }}
>
<ColorLensRoundedIcon fontSize="small" />
<ColorLensRoundedIcon />
</IconButton>
</Sheet>
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ColorPaletteProp } from '@mui/joy/styles';
import Avatar from '@mui/joy/Avatar';
import Badge, { badgeClasses } from '@mui/joy/Badge';
import Badge from '@mui/joy/Badge';
import Box from '@mui/joy/Box';
import Card from '@mui/joy/Card';
import CardContent from '@mui/joy/CardContent';
Expand All @@ -15,6 +15,7 @@ import ListItemButton from '@mui/joy/ListItemButton';
import ListItemDecorator from '@mui/joy/ListItemDecorator';
import Typography from '@mui/joy/Typography';
import Select from '@mui/joy/Select';
import Stack from '@mui/joy/Stack';
import Option from '@mui/joy/Option';
import Sheet from '@mui/joy/Sheet';
import PieChart from '@mui/icons-material/PieChart';
Expand All @@ -30,24 +31,23 @@ export default function ColorInversionNavigation() {
<Box sx={{ display: 'flex', borderRadius: 'sm', overflow: 'auto' }}>
<Sheet
variant="solid"
color="neutral"
invertedColors
sx={{
p: 2,
...(color !== 'neutral' && {
bgcolor: `${color}.800`,
bgcolor: `${color}.700`,
}),
}}
>
<Select
variant="outlined"
variant="soft"
defaultValue="1"
size="sm"
placeholder={
<div>
<Typography level="inherit">Saleshouse</Typography>
<Stack alignItems="start">
<Typography level="title-lg">Saleshouse</Typography>
<Typography level="body-md">general team</Typography>
</div>
</Stack>
}
startDecorator={
<Sheet
Expand All @@ -62,7 +62,13 @@ export default function ColorInversionNavigation() {
<BubbleChartIcon sx={{ m: 0 }} />
</Sheet>
}
sx={{ py: 1 }}
color={color}
sx={{
py: 1,
bgcolor: 'transparent',
border: '1px solid',
borderColor: 'divider',
}}
>
<Option value="1">General team</Option>
<Option value="2">Engineering team</Option>
Expand All @@ -89,8 +95,8 @@ export default function ColorInversionNavigation() {
<Chip
data-skip-inverted-colors
size="sm"
color="warning"
variant="soft"
color={color}
sx={{ ml: 'auto' }}
>
5
Expand Down Expand Up @@ -131,28 +137,27 @@ export default function ColorInversionNavigation() {
</Card>
</Sheet>
<Sheet
variant="soft"
color="neutral"
variant="solid"
invertedColors
sx={(theme) => ({
sx={{
p: 2,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 2,
...(color !== 'neutral' && {
bgcolor: `${color}.900`,
}),
bgcolor: `${color}.900`,

'& .MuiBadge-root': { '--Badge-ringColor': 'unset' },
'& .MuiBadge-colorSuccess': { bgcolor: 'success.400' },
'& button': {
borderRadius: '50%',
padding: 0,
'&:hover': {
boxShadow: theme.shadow.md,
},
'--IconButton-size': '3rem',
},
})}
}}
>
<Badge badgeContent="7" size="sm">
<IconButton>
<Badge badgeContent="7" badgeInset="15%" size="sm">
<IconButton size="lg">
<Avatar src="/static/images/avatar/3.jpg" />
</IconButton>
</Badge>
Expand All @@ -161,19 +166,18 @@ export default function ColorInversionNavigation() {
vertical: 'bottom',
horizontal: 'right',
}}
badgeInset="14%"
sx={{ [`& .${badgeClasses.badge}`]: { bgcolor: 'success.300' } }}
badgeInset="20%"
color="success"
>
<IconButton>
<IconButton size="lg">
<Avatar src="/static/images/avatar/4.jpg" />
</IconButton>
</Badge>
<IconButton variant="soft" aria-label="Add another chat">
<IconButton size="lg" aria-label="Add another chat">
<AddIcon />
</IconButton>
<IconButton
variant="plain"
size="sm"
size="lg"
onClick={() => {
const colors: ColorPaletteProp[] = [
'primary',
Expand All @@ -185,9 +189,9 @@ export default function ColorInversionNavigation() {
const nextColorIndex = colors.indexOf(color) + 1;
setColor(colors[nextColorIndex] ?? colors[0]);
}}
sx={{ mt: 'auto', height: '40px' }}
sx={{ mt: 'auto' }}
>
<ColorLensRoundedIcon fontSize="small" />
<ColorLensRoundedIcon />
</IconButton>
</Sheet>
</Box>
Expand Down
Loading