Skip to content

Commit

Permalink
mobile-specific fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-leal committed Nov 27, 2023
1 parent 2d2086e commit 259569a
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 53 deletions.
2 changes: 1 addition & 1 deletion docs/src/components/footer/EmailSubscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function EmailSubscribe({ sx }: { sx?: SxProps<Theme> }) {
mt: 1,
gap: 1.5,
width: { xs: '100%', sm: 'auto' },
maxWidth: 320,
maxWidth: { xs: '100%', sm: 320 },
}}
>
<InputBase
Expand Down
24 changes: 9 additions & 15 deletions docs/src/components/home/AdvancedShowcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DataGrid, GridCellParams, GridRenderEditCellParams, GridColDef } from '
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Typography from '@mui/material/Typography';
import Divider from '@mui/material/Divider';
import ShowcaseContainer from 'docs/src/components/home/ShowcaseContainer';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import MarkdownElement from 'docs/src/components/markdown/MarkdownElement';
Expand Down Expand Up @@ -1701,22 +1702,15 @@ export default function DataTable() {
})}
>
<XGridGlobalStyles />
<Box
sx={(theme) => ({
textAlign: 'center',
py: 1,
position: 'relative',
borderBottom: '1px solid',
borderColor: 'grey.100',
...theme.applyDarkStyles({
borderColor: 'primaryDark.600',
}),
})}
<Typography
variant="body2"
color="text.primary"
fontWeight="semiBold"
sx={{ position: 'relative', textAlign: 'center', py: 1.5 }}
>
<Typography color="primary.main" fontWeight={700}>
Trades, October 2020
</Typography>
</Box>
Trades, October 2020
</Typography>
<Divider />
<Box sx={{ height: 200 }}>
<DataGrid rows={rows} columns={columns} hideFooter density="compact" />
</Box>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productX/XComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function XComponents() {
item
xs={12}
md={6}
sx={componentIndex === 0 ? { minHeight: { xs: 777, sm: 757, md: 'unset' } } : {}}
sx={componentIndex === 0 ? { minHeight: { xs: 'auto', sm: 757, md: 'unset' } } : {}}
>
<React.Fragment>
{componentIndex === 0 && <XGridFullDemo />}
Expand Down
58 changes: 27 additions & 31 deletions docs/src/components/productX/XComponentsSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ function ComponentItem({
component="span"
sx={{
display: 'flex',
py: 1.5,
px: 2,
p: 2,
flexDirection: { xs: 'column', md: 'row' },
alignItems: { md: 'center' },
gap: 2.5,
Expand Down Expand Up @@ -90,12 +89,11 @@ function ComponentItem({
}

export default function XComponentsSwitcher(props: {
inView?: boolean;
componentIndex: number;
setComponentIndex: React.Dispatch<React.SetStateAction<number>>;
}) {
const { inView = false, componentIndex, setComponentIndex } = props;
const productElements = [
const { componentIndex, setComponentIndex } = props;
const componentElement = [
<ComponentItem
name="Data Grid"
label="Feature-rich and fast table extension."
Expand Down Expand Up @@ -135,40 +133,38 @@ export default function XComponentsSwitcher(props: {
'& > div': { pr: '32%' },
}}
>
{inView && (
<SwipeableViews
index={componentIndex}
resistance
enableMouseEvents
onChangeIndex={(index) => setComponentIndex(index)}
>
{productElements.map((element, index) => (
<Highlighter
key={index}
disableBorder
onClick={() => setComponentIndex(index)}
selected={componentIndex === index}
sx={{
width: '100%',
transition: '0.3s',
transform: componentIndex !== index ? 'scale(0.9)' : 'scale(1)',
}}
>
{element}
</Highlighter>
))}
</SwipeableViews>
)}
<SwipeableViews
index={componentIndex}
resistance
enableMouseEvents
onChangeIndex={(index) => setComponentIndex(index)}
>
{componentElement.map((element, index) => (
<Highlighter
key={index}
disableBorder
onClick={() => setComponentIndex(index)}
selected={componentIndex === index}
sx={{
width: '100%',
transition: '0.3s',
transform: componentIndex !== index ? 'scale(0.9)' : 'scale(1)',
}}
>
{element}
</Highlighter>
))}
</SwipeableViews>
</Box>
<Stack spacing={1} sx={{ display: { xs: 'none', md: 'flex' }, maxWidth: 500 }}>
{productElements.map((elm, index) => (
{componentElement.map((element, index) => (
<Highlighter
key={index}
disableBorder
onClick={() => setComponentIndex(index)}
selected={componentIndex === index}
>
{elm}
{element}
</Highlighter>
))}
</Stack>
Expand Down
11 changes: 8 additions & 3 deletions docs/src/components/productX/XGridFullDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function SettingsPanel(props: GridToolbarContainerProps) {
<FormGroup
className="MuiFormGroup-options"
sx={{
flexDirection: { xs: 'column', sm: 'row' },
flexDirection: 'row',
alignContent: { xs: 'start', sm: 'center' },
alignItems: { xs: 'start', sm: 'center' },
'& > *': {
Expand Down Expand Up @@ -109,7 +109,12 @@ function SettingsPanel(props: GridToolbarContainerProps) {
))}
</Select>
</FormControl>
<Button variant="outlined" size="small" onClick={handleApplyChanges}>
<Button
variant="outlined"
size="small"
onClick={handleApplyChanges}
sx={{ mt: { xs: 2, sm: 0 }, width: { xs: '100%', sm: 'fit-content' } }}
>
Apply changes
</Button>
</FormGroup>
Expand Down Expand Up @@ -266,7 +271,7 @@ export default function XGridFullDemo() {
/>
</Paper>
</Frame.Demo>
<Frame.Info data-mui-color-scheme="dark" sx={{ pl: 1, pr: 2, py: 1.5 }}>
<Frame.Info data-mui-color-scheme="dark" sx={{ pl: { xs: 2, sm: 1 }, pr: 2, py: 1.5 }}>
<SettingsPanel onApply={handleApplyClick} size={size} type={type} />
</Frame.Info>
</Frame>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/layouts/AppFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function AppFooter(props: AppFooterProps) {
<Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}>
Join our newsletter for regular updates. No spam ever.
</Typography>
<EmailSubscribe sx={{ mb: 4 }} />
<EmailSubscribe />
</div>
<Box
sx={{
Expand Down
3 changes: 2 additions & 1 deletion docs/src/layouts/HeroContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ export default function HeroContainer(props: HeroContainerProps) {
<Box sx={{ overflow: 'hidden' }}>
<Container
sx={{
pt: { xs: 8, sm: 0 },
minHeight: 500,
height: 'calc(100vh - 120px)',
height: { md: 'calc(100vh - 120px)' },
maxHeight: { md: 700, xl: 850 },
transition: '0.3s',
}}
Expand Down
1 change: 1 addition & 0 deletions docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import PageContext from 'docs/src/modules/components/PageContext';
const SearchButton = styled('button')(({ theme }) => [
{
minHeight: 34,
minWidth: 34,
display: 'flex',
alignItems: 'center',
margin: 0,
Expand Down

0 comments on commit 259569a

Please sign in to comment.