diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/App.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/App.tsx index fa1a766df74c00..1cc862e208fff5 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/App.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/App.tsx @@ -1,145 +1,98 @@ 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 NavBar from './components/NavBar'; 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 ( - ({ - '[data-feather], .feather': { - color: `var(--Icon-color, ${theme.vars.palette.text.icon})`, - margin: 'var(--Icon-margin)', - fontSize: `var(--Icon-fontSize, ${theme.vars.fontSize.xl})`, - width: '1em', - height: '1em', - }, - })} - /> - -
- -
- + + + + + + + + + + + + + + + + + + + + - margin: 0, - }} - > - - - - - - - - - - - - - - - - - - - - - - -
+ ); diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/ColorSchemeToggle.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/ColorSchemeToggle.tsx index 7804bd030b07e5..d1b512bb8a123b 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/ColorSchemeToggle.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/ColorSchemeToggle.tsx @@ -1,48 +1,61 @@ import * as React from 'react'; import { useColorScheme } from '@mui/joy/styles'; -import { ListItem, ListItemButton, ListItemButtonProps } from '@mui/joy'; +import IconButton, { IconButtonProps } from '@mui/joy/IconButton'; + +import DarkModeRoundedIcon from '@mui/icons-material/DarkModeRounded'; +import LightModeIcon from '@mui/icons-material/LightMode'; export default function ColorSchemeToggle({ onClick, sx, ...props -}: ListItemButtonProps) { +}: IconButtonProps) { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) { - return ; + return ( + + ); } - return ( - - ) => { - 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', - }, + { + if (mode === 'light') { + setMode('dark'); + } else { + setMode('light'); + } + onClick?.(event); + }} + sx={[ + { + '& > *:first-of-type': { + display: mode === 'dark' ? 'none' : 'initial', + }, + '& > *:last-of-type': { + display: mode === 'light' ? 'none' : 'initial', }, - ...(Array.isArray(sx) ? sx : [sx]), - ]} - > - - - - + }, + ...(Array.isArray(sx) ? sx : [sx]), + ]} + > + + + ); } diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/CountrySelector.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/CountrySelector.tsx index 788ec77f375c1a..1a5109caf79d67 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/CountrySelector.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/CountrySelector.tsx @@ -3,20 +3,18 @@ import Autocomplete from '@mui/joy/Autocomplete'; import AutocompleteOption from '@mui/joy/AutocompleteOption'; import AspectRatio from '@mui/joy/AspectRatio'; import FormControl, { FormControlProps } from '@mui/joy/FormControl'; +import FormLabel from '@mui/joy/FormLabel'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function ContrySelector({ sx, ...props }: FormControlProps) { return ( - + + Country option.code === value.code} - defaultValue={{ code: 'US', label: 'United States', phone: '1' }} + defaultValue={{ code: 'AU', label: 'Australia', phone: '61' }} options={countries} renderOption={(optionProps, option) => ( diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Filters.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Filters.tsx index 7c8d1b1c3dc451..639b8acea1c63b 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Filters.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/Filters.tsx @@ -1,48 +1,100 @@ import * as React from 'react'; +import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; +import Drawer from '@mui/joy/Drawer'; +import DialogTitle from '@mui/joy/DialogTitle'; import FormControl from '@mui/joy/FormControl'; +import FormLabel from '@mui/joy/FormLabel'; import Input from '@mui/joy/Input'; -import Grid from '@mui/joy/Grid'; +import ModalClose from '@mui/joy/ModalClose'; +import Stack from '@mui/joy/Stack'; +import Slider, { sliderClasses } from '@mui/joy/Slider'; +import FilterAltOutlined from '@mui/icons-material/FilterAltOutlined'; import CountrySelector from './CountrySelector'; +import OrderSelector from './OrderSelector'; + +function valueText(value: number) { + return `$${value.toLocaleString('en-US')}`; +} export default function Filters() { + const [open, setOpen] = React.useState(false); return ( -
- + + + setOpen(false)}> + + Filters + - + + Start date +
+ End date - - - - - - - + - + + + + Price range + - - - - - -
+ + + ); } diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/FirstSidebar.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/FirstSidebar.tsx deleted file mode 100644 index f36be022f12156..00000000000000 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/FirstSidebar.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import * as React from 'react'; -import GlobalStyles from '@mui/joy/GlobalStyles'; -import Avatar from '@mui/joy/Avatar'; -import List from '@mui/joy/List'; -import ListItem from '@mui/joy/ListItem'; -import ListItemButton from '@mui/joy/ListItemButton'; -import IconButton from '@mui/joy/IconButton'; -import Sheet from '@mui/joy/Sheet'; -import MuiLogo from './MuiLogo'; -import { openSidebar, closeSidebar } from '../utils'; -import ColorSchemeToggle from './ColorSchemeToggle'; - -export default function FirstSidebar() { - return ( - - - closeSidebar()} - sx={{ display: { md: 'none' }, mt: -2, borderRadius: '50%' }} - > - - - - - - - - - - - openSidebar()}> - - - - - openSidebar()}> - - - - - openSidebar()}> - - - - - openSidebar()}> - - - - - openSidebar()}> - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Header.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Header.tsx deleted file mode 100644 index d6235ffb95cd1a..00000000000000 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Header.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import * as React from 'react'; -import { useColorScheme } from '@mui/joy/styles'; -import GlobalStyles from '@mui/joy/GlobalStyles'; -import IconButton, { IconButtonProps } from '@mui/joy/IconButton'; -import Sheet from '@mui/joy/Sheet'; -import MuiLogo from './MuiLogo'; -import { toggleSidebar } from '../utils'; - -function ColorSchemeToggle({ onClick, sx, ...props }: IconButtonProps) { - const { mode, setMode } = useColorScheme(); - const [mounted, setMounted] = React.useState(false); - React.useEffect(() => { - setMounted(true); - }, []); - if (!mounted) { - return ( - - ); - } - return ( - { - if (mode === 'light') { - setMode('dark'); - } else { - setMode('light'); - } - onClick?.(event); - }} - sx={[ - { - '& > *:first-of-type': { - display: mode === 'dark' ? 'none' : 'initial', - }, - '& > *:last-of-type': { - display: mode === 'light' ? 'none' : 'initial', - }, - }, - ...(Array.isArray(sx) ? sx : [sx]), - ]} - > - - - - ); -} - -export default function Header() { - return ( - - ({ - ':root': { - '--Header-height': '52px', - [theme.breakpoints.up('md')]: { - '--Header-height': '0px', - }, - }, - })} - /> - toggleSidebar()} - variant="outlined" - color="neutral" - size="sm" - > - - - - - - ); -} diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/HeaderSection.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/HeaderSection.tsx index dbec55f8481033..45fc2554b81781 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/HeaderSection.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/HeaderSection.tsx @@ -1,46 +1,17 @@ import * as React from 'react'; -import Button from '@mui/joy/Button'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; export default function HeaderSection() { return ( - -
- - 232 stays in Melbourne - - - Book your next stay at one of our properties. - -
- - - - + + + Rental properties + + + Book your next stay at one of our properties. + ); } diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Main.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Main.tsx deleted file mode 100644 index 912e63a5103aa7..00000000000000 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Main.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; -import Box from '@mui/joy/Box'; - -type MainProps = { - children: React.ReactNode; -}; - -export default function Main({ children }: MainProps) { - return ( - - {children} - - ); -} diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/NavBar.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/NavBar.tsx new file mode 100644 index 00000000000000..f2b216a3093127 --- /dev/null +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/NavBar.tsx @@ -0,0 +1,65 @@ +import * as React from 'react'; +import { Box, IconButton } from '@mui/joy'; +import Typography from '@mui/joy/Typography'; +import Avatar from '@mui/joy/Avatar'; +import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; +import ColorSchemeToggle from './ColorSchemeToggle'; + +export default function HeaderSection() { + return ( + + + + + + + Acme Rental + + + + + + + + Siriwat K. + siriwatk@test.com + + + + + + ); +} diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/OrderSelector.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/OrderSelector.tsx new file mode 100644 index 00000000000000..15d19d1819fa0c --- /dev/null +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/OrderSelector.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import MenuButton from '@mui/joy/MenuButton'; +import Menu from '@mui/joy/Menu'; +import MenuItem from '@mui/joy/MenuItem'; +import ArrowDropDown from '@mui/icons-material/ArrowDropDown'; +import Dropdown from '@mui/joy/Dropdown'; + +export default function OrderSelector() { + return ( + + } + sx={{ whiteSpace: 'nowrap' }} + > + Order by + + + Price + Date + Rating + + + ); +} diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Pagination.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Pagination.tsx index 9671d994ce3f78..f077a1e44fe4ad 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Pagination.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/Pagination.tsx @@ -3,13 +3,20 @@ import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import IconButton, { iconButtonClasses } from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; +import ArrowBackIosRoundedIcon from '@mui/icons-material/ArrowBackIosRounded'; +import ArrowForwardIosRoundedIcon from '@mui/icons-material/ArrowForwardIosRounded'; export default function Pagination() { return (
- + Page 1 of 10 @@ -28,26 +35,27 @@ export default function Pagination() { color="neutral" size="sm" > - + @@ -57,7 +65,7 @@ export default function Pagination() { {page} @@ -69,7 +77,7 @@ export default function Pagination() { size="sm" variant="plain" color="neutral" - endDecorator={} + endDecorator={} > Next diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Rating.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Rating.tsx index e5bde46ecc813a..514e28979ad7b6 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Rating.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/Rating.tsx @@ -5,18 +5,18 @@ import Star from '@mui/icons-material/Star'; export default function Rating() { return ( - - - - - + + + + + } > - 4.9 + 4.0 ); } diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/RentalCard.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/RentalCard.tsx index ed68d8038d0764..cfb0f31072901e 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/RentalCard.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/RentalCard.tsx @@ -1,13 +1,19 @@ import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; -import Box from '@mui/joy/Box'; import Card from '@mui/joy/Card'; +import CardContent from '@mui/joy/CardContent'; +import CardOverflow from '@mui/joy/CardOverflow'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import Link from '@mui/joy/Link'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; -import Rating from './Rating'; +import WorkspacePremiumRoundedIcon from '@mui/icons-material/WorkspacePremiumRounded'; +import FavoriteRoundedIcon from '@mui/icons-material/FavoriteRounded'; +import FmdGoodRoundedIcon from '@mui/icons-material/FmdGoodRounded'; +import KingBedRoundedIcon from '@mui/icons-material/KingBedRounded'; +import WifiRoundedIcon from '@mui/icons-material/WifiRounded'; +import Star from '@mui/icons-material/Star'; type RentalCardProps = { category: React.ReactNode; @@ -30,146 +36,138 @@ export default function RentalCard({ variant="outlined" orientation="horizontal" sx={{ - transition: '250ms all', - padding: { - xs: 0, - sm: 2, + bgcolor: 'neutral.softBg', + display: 'flex', + flexDirection: { xs: 'column', sm: 'row' }, + '&:hover': { + boxShadow: 'lg', + borderColor: 'var(--joy-palette-neutral-outlinedDisabledBorder)', }, - boxShadow: 'none', - borderRadius: 'sm', - '&:hover': { boxShadow: 'md', borderColor: 'neutral.outlinedHoverBorder' }, }} > - - - ({ - borderRadius: 'xs', - [theme.breakpoints.down('sm')]: { - borderBottomLeftRadius: 0, - borderBottomRightRadius: 0, - }, - })} + + - {rareFind && ( } - size="sm" - sx={{ position: 'absolute', bottom: 8, left: 8 }} + color="success" + startDecorator={} + size="md" > Rare find )} setIsLiked((prev) => !prev)} sx={{ - position: 'absolute', - bottom: 8, - right: 8, display: { xs: 'flex', sm: 'none' }, + ml: 'auto', + borderRadius: '50%', + zIndex: '20', }} > - + - - + + + + - + {category} + + + {title} + + +
+ setIsLiked((prev) => !prev)} + sx={{ + display: { xs: 'none', sm: 'flex' }, + borderRadius: '50%', + }} > -
- - {category} - - - - {title} - - -
- setIsLiked((prev) => !prev)} - sx={{ - display: { xs: 'none', sm: 'flex' }, - }} - > - - -
- - - - 202 reviews - + +
+ - - }> - Collingwood VIC - - } - display={{ - xs: 'none', - md: 'flex', - }} - > - 1 bed - - } - display={{ - xs: 'none', - md: 'flex', - }} - > - Wi-Fi - - - $540 total - - + + }> + Collingwood VIC + + }> + 1 bed + + }> + Wi-Fi + + + + + + + + + + + } + sx={{ display: 'flex', gap: 1 }} + > + 4.0 + + + $540 total + - + ); } diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Search.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Search.tsx index dc35a31c28cf07..45716c18580888 100644 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Search.tsx +++ b/docs/data/joy/getting-started/templates/rental-dashboard/components/Search.tsx @@ -1,30 +1,28 @@ import * as React from 'react'; -import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import FormControl from '@mui/joy/FormControl'; import Input from '@mui/joy/Input'; import Stack from '@mui/joy/Stack'; +import SearchRoundedIcon from '@mui/icons-material/SearchRounded'; +import Typography from '@mui/joy/Typography'; export default function Search() { return ( - - - } - aria-label="Search" - /> - - - - - +
+ + + } + aria-label="Search" + /> + - - + + 232 stays in Melbourne, Australia +
); } diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/components/Toggles.tsx b/docs/data/joy/getting-started/templates/rental-dashboard/components/Toggles.tsx deleted file mode 100644 index 3a5a079825260f..00000000000000 --- a/docs/data/joy/getting-started/templates/rental-dashboard/components/Toggles.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import * as React from 'react'; -import { Stack } from '@mui/joy'; -import ToggleGroup from './ToggleGroup'; - -export default function Toggles() { - return ( - - - , value: 'list' }, - { label: , value: 'map' }, - ]} - /> - - ); -} diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/useScript.ts b/docs/data/joy/getting-started/templates/rental-dashboard/useScript.ts deleted file mode 100644 index 205f011215caa6..00000000000000 --- a/docs/data/joy/getting-started/templates/rental-dashboard/useScript.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as React from 'react'; - -export type UseScriptStatus = 'idle' | 'loading' | 'ready' | 'error'; - -// Cached script statuses -const cachedScriptStatuses: Record = {}; - -/** - * Simplified version of https://usehooks-ts.com/react-hook/use-script - */ -function getScriptNode(src: string) { - const node: HTMLScriptElement | null = document.querySelector(`script[src="${src}"]`); - const status = node?.getAttribute('data-status') as UseScriptStatus | undefined; - - return { - node, - status, - }; -} - -function useScript(src: string): UseScriptStatus { - const [status, setStatus] = React.useState(() => { - if (typeof window === 'undefined') { - // SSR Handling - always return 'loading' - return 'loading'; - } - - return cachedScriptStatuses[src] ?? 'loading'; - }); - - React.useEffect(() => { - const cachedScriptStatus = cachedScriptStatuses[src]; - if (cachedScriptStatus === 'ready' || cachedScriptStatus === 'error') { - // If the script is already cached, set its status immediately - setStatus(cachedScriptStatus); - return; - } - - // Fetch existing script element by src - // It may have been added by another instance of this hook - const script = getScriptNode(src); - let scriptNode = script.node; - - if (!scriptNode) { - // Create script element and add it to document body - scriptNode = document.createElement('script'); - scriptNode.src = src; - scriptNode.async = true; - scriptNode.setAttribute('data-status', 'loading'); - document.body.appendChild(scriptNode); - - // Store status in attribute on script - // This can be read by other instances of this hook - const setAttributeFromEvent = (event: Event) => { - const scriptStatus: UseScriptStatus = event.type === 'load' ? 'ready' : 'error'; - - scriptNode?.setAttribute('data-status', scriptStatus); - }; - - scriptNode.addEventListener('load', setAttributeFromEvent); - scriptNode.addEventListener('error', setAttributeFromEvent); - } else { - // Grab existing script status from attribute and set to state. - setStatus(script.status ?? cachedScriptStatus ?? 'loading'); - } - - // Script event handler to update status in state - // Note: Even if the script already exists we still need to add - // event handlers to update the state for *this* hook instance. - const setStateFromEvent = (event: Event) => { - const newStatus = event.type === 'load' ? 'ready' : 'error'; - setStatus(newStatus); - cachedScriptStatuses[src] = newStatus; - }; - - // Add event listeners - scriptNode.addEventListener('load', setStateFromEvent); - scriptNode.addEventListener('error', setStateFromEvent); - - // Remove event listeners on cleanup - // eslint-disable-next-line consistent-return - return () => { - if (scriptNode) { - scriptNode.removeEventListener('load', setStateFromEvent); - scriptNode.removeEventListener('error', setStateFromEvent); - } - - if (scriptNode) { - try { - scriptNode.remove(); - } catch (error) { - // ignore error - } - } - }; - }, [src]); - - return status; -} - -export default useScript; diff --git a/docs/data/joy/getting-started/templates/rental-dashboard/utils.ts b/docs/data/joy/getting-started/templates/rental-dashboard/utils.ts deleted file mode 100644 index 83220658582ce6..00000000000000 --- a/docs/data/joy/getting-started/templates/rental-dashboard/utils.ts +++ /dev/null @@ -1,26 +0,0 @@ -export const openSidebar = () => { - if (typeof document !== 'undefined') { - document.body.style.overflow = 'hidden'; - document.documentElement.style.setProperty('--SideNavigation-slideIn', '1'); - } -}; - -export const closeSidebar = () => { - if (typeof document !== 'undefined') { - document.documentElement.style.removeProperty('--SideNavigation-slideIn'); - document.body.style.removeProperty('overflow'); - } -}; - -export const toggleSidebar = () => { - if (typeof window !== 'undefined' && typeof document !== 'undefined') { - const slideIn = window - .getComputedStyle(document.documentElement) - .getPropertyValue('--SideNavigation-slideIn'); - if (slideIn) { - closeSidebar(); - } else { - openSidebar(); - } - } -}; diff --git a/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard-dark.jpg b/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard-dark.jpg index 90ea71583bc2ac..c22fa87a2ab0c5 100644 Binary files a/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard-dark.jpg and b/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard-dark.jpg differ diff --git a/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard.jpg b/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard.jpg index d464c6e26cedbe..c68699ad64aba8 100644 Binary files a/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard.jpg and b/docs/public/static/screenshots/joy-ui/getting-started/templates/rental-dashboard.jpg differ diff --git a/docs/scripts/generateTemplateScreenshots.ts b/docs/scripts/generateTemplateScreenshots.ts index 8279cda61c6ab5..e8c0b5dacade8f 100644 --- a/docs/scripts/generateTemplateScreenshots.ts +++ b/docs/scripts/generateTemplateScreenshots.ts @@ -2,9 +2,18 @@ import fs from 'fs/promises'; import path from 'path'; import { chromium } from 'playwright'; +/** + * Usage: + * - `yarn screenshot` to generate all screenshots + * - `yarn screenshot order-dashboard` to generate screenshots for `docs/pages/joy-ui/getting-started/templates/order-dashboard.tsx` + * - `yarn screenshot [...templates]` to generate screenshots for the templates in `docs/pages/joy-ui/getting-started/templates/*` + */ + const host = process.env.DEPLOY_PREVIEW || 'http://localhost:3000'; const directory = 'docs/public/static/screenshots'; +const names = new Set(process.argv.slice(2)); + (async () => { // eslint-disable-next-line no-console console.info('Host:', host); @@ -15,7 +24,11 @@ const directory = 'docs/public/static/screenshots'; path.join(process.cwd(), 'docs/pages/joy-ui/getting-started/templates'), ); const urls = files - .filter((file) => !file.startsWith('index')) + .filter( + (file) => + !file.startsWith('index') && + (names.size === 0 || names.has(file.replace(/\.(js|tsx)$/, ''))), + ) .map((file) => `/joy-ui/getting-started/templates/${file.replace(/\.(js|tsx)$/, '/')}`); try {