From f42e9b7d789ab9bd0240081ab69639a47cc45758 Mon Sep 17 00:00:00 2001 From: Victor Zanivan Monteiro Date: Thu, 29 Feb 2024 12:26:09 -0300 Subject: [PATCH] [docs] Add polish to the date-picker playground (#11869) Co-authored-by: noraleonte --- .../CustomizationExamplesNoSnap.js | 2 +- .../components/CustomizationPlayground.tsx | 101 +++++++++++------- 2 files changed, 63 insertions(+), 40 deletions(-) diff --git a/docs/data/date-pickers/date-picker/CustomizationExamplesNoSnap.js b/docs/data/date-pickers/date-picker/CustomizationExamplesNoSnap.js index ccde819f01bc..3b1a1f36bb4c 100644 --- a/docs/data/date-pickers/date-picker/CustomizationExamplesNoSnap.js +++ b/docs/data/date-pickers/date-picker/CustomizationExamplesNoSnap.js @@ -28,7 +28,7 @@ export default function CustomizationExamplesNoSnap() { return ( - + ({ display: 'flex', + border: '1px solid', + borderColor: alpha(theme.palette.grey[500], 0.2), borderRadius: theme.shape.borderRadius, - border: `1px solid ${grey[200]}`, padding: theme.spacing(2), gap: theme.spacing(2), justifyContent: 'space-between', @@ -54,7 +54,8 @@ const PlaygroundDemoArea = styled('div')(({ theme }) => ({ const PlaygroundConfigArea = styled('div')(({ theme }) => ({ padding: theme.spacing(2), backgroundColor: alpha(theme.palette.primary.light, 0.05), - border: `1px solid ${grey[200]}`, + border: '1px solid', + borderColor: alpha(theme.palette.grey[500], 0.2), borderRadius: '4px', [theme.breakpoints.down('lg')]: { display: 'flex', @@ -74,45 +75,62 @@ const ConfigSectionWrapper = styled('div')(({ theme }) => ({ })); const ConfigLabel = styled(Typography)(({ theme }) => ({ - marginTop: theme.spacing(2), + marginTop: theme.spacing(4), marginBottom: theme.spacing(1), fontWeight: theme.typography.fontWeightBold, - fontSize: theme.typography.pxToRem(12), - textTransform: 'uppercase', + fontSize: theme.typography.pxToRem(14), letterSpacing: '.08rem', + '&:first-of-type': { + marginTop: theme.spacing(1), + }, + '&:last-of-type': { + marginTop: theme.spacing(4), + }, })); const ConfigItemLabel = styled(Typography)(({ theme }) => ({ ...theme.typography.caption, letterSpacing: '.08rem', - textTransform: 'uppercase', color: theme.palette.text.secondary, - fontSize: theme.typography.pxToRem(11), + fontSize: theme.typography.pxToRem(12), fontweight: 600, })); const SlotItemsWrapper = styled('div')(({ theme }) => ({ display: 'flex', - gap: theme.spacing(0.5), + gap: theme.spacing(1), flexWrap: 'wrap', })); const SlotItem = styled(Button)(({ theme }) => ({ borderWidth: 1, - borderRadius: theme.spacing(2), + borderRadius: '99px', textTransform: 'none', padding: theme.spacing(0.1, 1), })); const TabsWrapper = styled('div')(({ theme }) => ({ display: 'flex', - alignItems: 'center', + alignItems: 'end', justifyContent: 'space-between', - marginBottom: theme.spacing(1), - gap: theme.spacing(1), [theme.breakpoints.down('sm')]: { flexDirection: 'column', alignItems: 'flex-start', + gap: theme.spacing(4), + }, +})); +const StyledTabs = styled(Tabs)(({ theme }) => ({ + mt: 1, + mb: '-16px', + '& .MuiTabs-indicator': { + display: 'flex', + justifyContent: 'center', + backgroundColor: 'transparent', + }, + '& .MuiTabs-indicatorSpan': { + maxWidth: '60%', + width: '100%', + backgroundColor: theme.palette.primary.main, }, })); @@ -124,13 +142,18 @@ type TabsProps = { function StylingApproachTabs({ value, onChange, options }: TabsProps) { return ( - - +
+ }} + > {(Object.keys(options) as Array)?.map((option) => ( ))} - - + +
); } @@ -154,7 +177,7 @@ function StylingRecommendation({ if (isMobile) { return ( - + {displayedMessage} ); @@ -163,7 +186,7 @@ function StylingRecommendation({ return ( - + ); } @@ -268,6 +291,7 @@ function NumericTokensSlider({ max={20} marks step={1} + valueLabelDisplay="auto" /> ))} @@ -308,25 +332,6 @@ const CustomizationPlayground = function CustomizationPlayground({ return ( - {selectedDemo && customizationOptions && selectedCustomizationOption && ( - - - { - setSelectedCustomizationOption(newValue); - }} - value={selectedCustomizationOption} - options={customizationOptions} - /> - {selectedExample && ( - - )} - {' '} - - )} @@ -400,7 +405,25 @@ const CustomizationPlayground = function CustomizationPlayground({
)} - + {selectedDemo && customizationOptions && selectedCustomizationOption && ( + + + { + setSelectedCustomizationOption(newValue); + }} + value={selectedCustomizationOption} + options={customizationOptions} + /> + {selectedExample && ( + + )} + + + )} {shouldBeInteractive && ( )}