From 9ef911a6e036a69f8a03c398a76fe8ffe7e7afd8 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:20:26 -0300 Subject: [PATCH] [docs][Data Grid] Adjust the demo page design (#11231) Co-authored-by: Andrew Cherniavskii --- .../data-grid/demo/PopularFeaturesDemo.js | 159 +++++++++++++----- .../data-grid/demo/PopularFeaturesDemo.tsx | 159 +++++++++++++----- docs/data/data-grid/demo/demo.md | 8 +- docs/public/static/x/community.svg | 1 + 4 files changed, 236 insertions(+), 91 deletions(-) create mode 100644 docs/public/static/x/community.svg diff --git a/docs/data/data-grid/demo/PopularFeaturesDemo.js b/docs/data/data-grid/demo/PopularFeaturesDemo.js index 650a75f6b272e..b30a71abeae74 100644 --- a/docs/data/data-grid/demo/PopularFeaturesDemo.js +++ b/docs/data/data-grid/demo/PopularFeaturesDemo.js @@ -12,7 +12,9 @@ import Typography from '@mui/material/Typography'; import Box from '@mui/material/Box'; import ArrowUp from '@mui/icons-material/KeyboardArrowUp'; import ArrowDown from '@mui/icons-material/KeyboardArrowDown'; -import { useTheme } from '@mui/material/styles'; +import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; +import { useTheme, alpha } from '@mui/material/styles'; +import { yellow, blue, green } from '@mui/material/colors'; import AggregationRowGrouping from '../aggregation/AggregationRowGrouping'; import BasicColumnPinning from '../column-pinning/BasicColumnPinning'; import ColumnSelectorGrid from '../column-visibility/ColumnSelectorGrid'; @@ -231,38 +233,71 @@ export const featuresSet = [ function getChipProperties(plan) { switch (plan) { case 'Premium': - return { avatarLink: '/static/x/premium.svg', color: '#ffecc8' }; + return { avatarLink: '/static/x/premium.svg' }; case 'Pro': - return { avatarLink: '/static/x/pro.svg', color: '#c8e9ff' }; + return { avatarLink: '/static/x/pro.svg' }; default: - return { avatarLink: undefined, color: '#c8ffdb' }; + return { avatarLink: '/static/x/community.svg' }; } } function PlanTag(props) { - const chipPropperties = getChipProperties(props.plan); - const avatar = !chipPropperties.avatarLink ? undefined : ( - + const theme = useTheme(); + const chipProperties = getChipProperties(props.plan); + const avatar = !chipProperties.avatarLink ? undefined : ( + ); return ( ); } function CustomToolbar() { return ( - + ); @@ -271,19 +306,46 @@ function CustomToolbar() { function RowDemo(props) { const { row } = props; const theme = useTheme(); - const gridBgColor = theme.palette.mode === 'dark' ? '#000' : '#fff'; - const panelColor = theme.palette.mode === 'dark' ? 'transparent' : '#efefef'; return ( - +
- {row.demo} + + {row.demo} + {row.linkToCode ? ( - - - Open demo source - - + svg': { transition: '0.2s' }, + '&:hover > svg': { transform: 'translateX(2px)' }, + }} + > + View the demo source + + ) : null}
@@ -323,7 +385,7 @@ const columns = [ alignItems: 'center', }} > - + {params.row.newBadge && ( - - New - + ({ + ml: 1, + p: 0.2, + height: 'auto', + fontSize: theme.typography.pxToRem(10), + fontWeight: 'bold', + textTransform: 'uppercase', + letterSpacing: '.04rem', + '& .MuiChip-label': { + px: '4px', + }, + })} + /> )}
); @@ -426,7 +487,15 @@ export default function PopularFeaturesDemo() { }, []); return ( - + + const theme = useTheme(); + const chipProperties = getChipProperties(props.plan); + const avatar = !chipProperties.avatarLink ? undefined : ( + ); return ( ); } function CustomToolbar() { return ( - + ); @@ -286,19 +321,46 @@ function CustomToolbar() { function RowDemo(props: { row: Row }) { const { row } = props; const theme = useTheme(); - const gridBgColor = theme.palette.mode === 'dark' ? '#000' : '#fff'; - const panelColor = theme.palette.mode === 'dark' ? 'transparent' : '#efefef'; return ( - +
- {row.demo} + + {row.demo} + {row.linkToCode ? ( - - - Open demo source - - + svg': { transition: '0.2s' }, + '&:hover > svg': { transform: 'translateX(2px)' }, + }} + > + View the demo source + + ) : null}
@@ -338,7 +400,7 @@ const columns: GridColDef[] = [ alignItems: 'center', }} > - + {params.row.newBadge && ( - - New - + ({ + ml: 1, + p: 0.2, + height: 'auto', + fontSize: theme.typography.pxToRem(10), + fontWeight: 'bold', + textTransform: 'uppercase', + letterSpacing: '.04rem', + '& .MuiChip-label': { + px: '4px', + }, + })} + /> )}
); @@ -447,7 +508,15 @@ export default function PopularFeaturesDemo() { }, []); return ( - + Use the demo below to explore the most significant features and their respective plans.

+

Explore all of the Data Grid features and understand which plan they're available in.

:::info -This demo uses the Data Grid to display a table of features. - -Filtering, sorting, and grouping (by plan) are at your disposal to help you explore the list. +Note that this demo itself uses the Data Grid with features such as filtering, sorting, and grouping! ::: {{"demo": "PopularFeaturesDemo.js", "defaultCodeOpen": false, "bg": "inline", "hideToolbar": true}} diff --git a/docs/public/static/x/community.svg b/docs/public/static/x/community.svg new file mode 100644 index 0000000000000..c6f705ea6f92f --- /dev/null +++ b/docs/public/static/x/community.svg @@ -0,0 +1 @@ + \ No newline at end of file