diff --git a/docs/pages/experiments/material-ui/mobile-stepper.tsx b/docs/pages/experiments/material-ui/mobile-stepper.tsx new file mode 100644 index 00000000000000..f8e35214623738 --- /dev/null +++ b/docs/pages/experiments/material-ui/mobile-stepper.tsx @@ -0,0 +1,146 @@ +import * as React from 'react'; +import { + Experimental_CssVarsProvider as CssVarsProvider, + useColorScheme, + useTheme, +} from '@mui/material/styles'; +import CssBaseline from '@mui/material/CssBaseline'; +import Box from '@mui/material/Box'; +import Container from '@mui/material/Container'; +import Moon from '@mui/icons-material/DarkMode'; +import Sun from '@mui/icons-material/LightMode'; +import MobileStepper from '@mui/material/MobileStepper'; +import Paper from '@mui/material/Paper'; +import Typography from '@mui/material/Typography'; +import Button from '@mui/material/Button'; +import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft'; +import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight'; + +const steps = [ + { + label: 'Select campaign settings', + description: `For each ad campaign that you create, you can control how much + you're willing to spend on clicks and conversions, which networks + and geographical locations you want your ads to show on, and more.`, + }, + { + label: 'Create an ad group', + description: 'An ad group contains one or more ads which target a shared set of keywords.', + }, + { + label: 'Create an ad', + description: `Try out different ad text to see what brings in the most customers, + and learn how to enhance your ads using features like ad extensions. + If you run into any problems with your ads, find out how to tell if + they're running and how to resolve approval issues.`, + }, +]; + +function TextMobileStepper() { + const theme = useTheme(); + const [activeStep, setActiveStep] = React.useState(0); + const maxSteps = steps.length; + + const handleNext = () => { + setActiveStep((prevActiveStep) => prevActiveStep + 1); + }; + + const handleBack = () => { + setActiveStep((prevActiveStep) => prevActiveStep - 1); + }; + + return ( + + + {steps[activeStep].label} + + + {steps[activeStep].description} + + + Next + {theme.direction === 'rtl' ? : } + + } + backButton={ + + } + /> + + ); +} + +const ColorSchemePicker = () => { + const { mode, setMode } = useColorScheme(); + const [mounted, setMounted] = React.useState(false); + React.useEffect(() => { + setMounted(true); + }, []); + if (!mounted) { + return null; + } + + return ( + + ); +}; + +export default function CssVarsTemplate() { + return ( + + + + + + + div': { + placeSelf: 'center', + }, + }} + > + Mobile Stepper + + + + + + + + ); +} diff --git a/packages/mui-material/src/MobileStepper/MobileStepper.js b/packages/mui-material/src/MobileStepper/MobileStepper.js index 722f45c73513c5..227506cbb3b32b 100644 --- a/packages/mui-material/src/MobileStepper/MobileStepper.js +++ b/packages/mui-material/src/MobileStepper/MobileStepper.js @@ -37,21 +37,21 @@ const MobileStepperRoot = styled(Paper, { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', - background: theme.palette.background.default, + background: (theme.vars || theme).palette.background.default, padding: 8, ...(ownerState.position === 'bottom' && { position: 'fixed', bottom: 0, left: 0, right: 0, - zIndex: theme.zIndex.mobileStepper, + zIndex: (theme.vars || theme).zIndex.mobileStepper, }), ...(ownerState.position === 'top' && { position: 'fixed', top: 0, left: 0, right: 0, - zIndex: theme.zIndex.mobileStepper, + zIndex: (theme.vars || theme).zIndex.mobileStepper, }), })); @@ -80,13 +80,13 @@ const MobileStepperDot = styled('div', { transition: theme.transitions.create('background-color', { duration: theme.transitions.duration.shortest, }), - backgroundColor: theme.palette.action.disabled, + backgroundColor: (theme.vars || theme).palette.action.disabled, borderRadius: '50%', width: 8, height: 8, margin: '0 2px', ...(dotActive && { - backgroundColor: theme.palette.primary.main, + backgroundColor: (theme.vars || theme).palette.primary.main, }), }), }));