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][joy] Add a rental dashboard template #37453

Merged
merged 45 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
23c45a3
starting rental dashboard
sernstberger May 25, 2023
328077b
added header
sernstberger May 25, 2023
0c7fb90
added country selector and content to cards
sernstberger May 25, 2023
3c56a26
adding icons and laying it out
sernstberger May 25, 2023
5b371a6
created rental card
sernstberger May 25, 2023
91af78c
move into grid
sernstberger May 25, 2023
80d0f8b
added map image
sernstberger May 25, 2023
fd091e8
added toggle group
sernstberger May 26, 2023
d542e35
created main component
sernstberger May 26, 2023
9a5f50a
componentizing
sernstberger May 26, 2023
6d14512
toggles component and rental card clickable
sernstberger May 26, 2023
8b1164c
moved colorschemetoggle
sernstberger May 27, 2023
fb0f3de
fixed scrollbar issues
sernstberger May 27, 2023
af7f066
improved layout
sernstberger May 27, 2023
dd24757
desktop view looks nice
sernstberger May 27, 2023
44781fc
improving layout
sernstberger May 29, 2023
8f71fde
lots of rental card styling
sernstberger May 30, 2023
f13ed1d
layout cleanup
sernstberger May 30, 2023
57b708a
hide mini map on large screens
sernstberger May 30, 2023
d3e0192
improved header
sernstberger May 30, 2023
70b7b75
rental card cleanup
sernstberger May 30, 2023
a7c900f
marking rental card dynamic
sernstberger May 30, 2023
866070f
added pagination
sernstberger May 31, 2023
48a20e6
card image looks better
sernstberger May 31, 2023
901eb3b
added images and spacing
sernstberger May 31, 2023
3c111e3
cleanup
sernstberger May 31, 2023
6f05a46
add screenshots and twitter handle
sernstberger May 31, 2023
fe89961
added "designed by"
sernstberger May 31, 2023
11931ba
fixed type issue
sernstberger May 31, 2023
17febda
tweaks to the TemplateCollection file to make this template new
danilo-leal May 31, 2023
416420b
Merge branch 'rental-dashboard' of https://github.com/sernstberger/ma…
danilo-leal May 31, 2023
8282860
comment cleanup
sernstberger May 31, 2023
1f286fa
Update docs/data/joy/getting-started/templates/rental-dashboard/App.tsx
sernstberger May 31, 2023
b979bc7
fix component name
sernstberger May 31, 2023
38b42bf
no more extra scroll bar
sernstberger May 31, 2023
bb91e88
add close sidebar in small viewport
siriwatknp Jun 1, 2023
b2d14a5
Small visual tweaks
zanivan Jun 1, 2023
6989dcb
Same map image on desktop an mobile
zanivan Jun 1, 2023
9cd40e4
prettier fix
sernstberger Jun 1, 2023
29e826b
updated screenshots
sernstberger Jun 2, 2023
b0216ae
Update docs/data/joy/getting-started/templates/rental-dashboard/App.tsx
sernstberger Jun 5, 2023
6172e70
Update docs/data/joy/getting-started/templates/rental-dashboard/compo…
sernstberger Jun 5, 2023
df1472a
Update docs/data/joy/getting-started/templates/rental-dashboard/compo…
sernstberger Jun 5, 2023
3317543
Update docs/data/joy/getting-started/templates/rental-dashboard/compo…
sernstberger Jun 5, 2023
e00012f
new images with design tweaks
sernstberger Jun 5, 2023
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
12 changes: 10 additions & 2 deletions docs/data/joy/getting-started/templates/TemplateCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const AUTHORS = {
name: 'MUI',
link: 'https://twitter.com/MUI_hq',
},
'rental-dashboard': {
name: 'Steve Ernstberger',
link: 'https://twitter.com/steveeberger',
},
};
const DESIGNS = {
'order-dashboard': {
Expand All @@ -73,13 +77,17 @@ const DESIGNS = {
name: 'Frames X',
link: 'https://framesxfigma.buninux.com/',
},
'rental-dashboard': {
name: 'Untitled UI',
link: 'https://www.figma.com/community/file/1020079203222518115/%E2%9D%96-Untitled-UI-%E2%80%93-FREE-Figma-UI-kit-and-design-system',
},
};

export default function TemplateCollection() {
const newTemplates = [
'rental-dashboard',
'framesx-web-blocks',
'profile-dashboard',
'order-dashboard',
]; // Stay at the top of the page with `new` badge
const { names: templateNames, map: templateMap } = sourceJoyTemplates();
const names = [
Expand Down Expand Up @@ -256,7 +264,7 @@ export default function TemplateCollection() {
</SvgIcon>
</IconButton>
</Box>
<Box sx={{ width: '100%', display: 'flex', alignItems: 'baseline' }}>
<Box sx={{ width: '100%', display: 'flex', alignItems: 'center' }}>
{author && (
<Typography level="body2" fontWeight="md">
Built by{' '}
Expand Down
147 changes: 147 additions & 0 deletions docs/data/joy/getting-started/templates/rental-dashboard/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import * as React from 'react';
import { CssVarsProvider } from '@mui/joy/styles';
import GlobalStyles from '@mui/joy/GlobalStyles';
import CssBaseline from '@mui/joy/CssBaseline';
import Box from '@mui/joy/Box';
import Divider from '@mui/joy/Divider';
import Grid from '@mui/joy/Grid';
import Stack from '@mui/joy/Stack';
import useScript from './useScript';
import FirstSidebar from './components/FirstSidebar';
import Header from './components/Header';
import customTheme from './theme';
import RentalCard from './components/RentalCard';
import Main from './components/Main';
import HeaderSection from './components/HeaderSection';
import Search from './components/Search';
import Filters from './components/Filters';
import Toggles from './components/Toggles';
import Pagination from './components/Pagination';

const useEnhancedEffect =
typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;

export default function RentalDashboard() {
const status = useScript(`https://unpkg.com/feather-icons`);

useEnhancedEffect(() => {
// Feather icon setup: https://github.com/feathericons/feather#4-replace
// @ts-ignore
if (typeof feather !== 'undefined') {
// @ts-ignore
feather.replace();
}
}, [status]);

return (
<CssVarsProvider disableTransitionOnChange theme={customTheme}>
<GlobalStyles
styles={{
'[data-feather], .feather': {
color: 'var(--Icon-color)',
margin: 'var(--Icon-margin)',
fontSize: 'var(--Icon-fontSize, 20px)',
width: '1em',
height: '1em',
},
}}
/>
<CssBaseline />
<Box sx={{ display: 'flex', minHeight: '100dvh' }}>
<Header />
<FirstSidebar />
<Main>
<Grid
container
sx={{
width: '100%',
height: '100dvh',

margin: 0,
}}
>
<Grid
xs={12}
lg={8}
sx={{
overflowY: 'scroll',
height: '100%',
px: { xs: 2, md: 4 },
pt: { xs: 8, md: 4 },
pb: 5,
}}
>
<Stack spacing={2}>
<HeaderSection />
<Divider />
<Box
sx={{
width: '100%',
height: 360,
backgroundSize: 'cover',
backgroundImage:
'url("https://images.unsplash.com/photo-1478860409698-8707f313ee8b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=4000&q=80")',
}}
display={{ xs: 'block', md: 'none' }}
/>
<Filters />
<Search />
<Toggles />
<RentalCard
title="A Stylish Apt, 5 min walk to Queen Victoria Market"
category="Entire apartment rental in Collingwood"
rareFind
image="https://images.unsplash.com/photo-1568605114967-8130f3a36994?auto=format&fit=crop&w=400"
/>
<RentalCard
title="Designer NY style loft"
category="Entire loft in central business district"
liked
image="https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?auto=format&fit=crop&w=400"
/>
<RentalCard
title="5 minute walk from University of Melbourne"
category="Entire rental unit in Carlton"
image="https://images.unsplash.com/photo-1537726235470-8504e3beef77?auto=format&fit=crop&w=400"
/>
<RentalCard
title="Magnificent apartment next to public transport"
category="Entire apartment rental in Collingwood"
image="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?auto=format&fit=crop&w=400"
/>
<Divider />
<Pagination />
</Stack>
</Grid>
<Grid
xs={4}
sx={{
display: { xs: 'none', lg: 'block' },
}}
>
<Box
sx={{
borderLeft: '1px solid',
borderColor: 'divider',
padding: 1.5,
height: '100dvh',
}}
>
<Box
sx={{
backgroundColor: 'background.level1',
height: '100%',
borderRadius: 'sm',
backgroundSize: 'cover',
backgroundImage:
'url("https://images.unsplash.com/photo-1478860409698-8707f313ee8b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=4000&q=80")',
}}
/>
</Box>
</Grid>
</Grid>
</Main>
</Box>
</CssVarsProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as React from 'react';
import { useColorScheme } from '@mui/joy/styles';
import { ListItem, ListItemButton, ListItemButtonProps } from '@mui/joy';

export default function ColorSchemeToggle({
onClick,
sx,
...props
}: ListItemButtonProps) {
const { mode, setMode } = useColorScheme();
const [mounted, setMounted] = React.useState(false);
React.useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return <ListItemButton {...props} sx={sx} disabled />;
}

return (
<ListItem>
<ListItemButton
id="toggle-mode"
onClick={(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
if (mode === 'light') {
setMode('dark');
} else {
setMode('light');
}
onClick?.(event);
}}
sx={[
{
'& > *:first-child': {
display: mode === 'dark' ? 'none' : 'initial',
},
'& > *:last-child': {
display: mode === 'light' ? 'none' : 'initial',
},
},
...(Array.isArray(sx) ? sx : [sx]),
]}
>
<i data-feather="moon" />
<i data-feather="sun" />
</ListItemButton>
</ListItem>
);
}
Loading