PackageDetail: keep CTAs side-by-side on mobile, size medium on xs
The Make Arrangement + Compare buttons stacked vertically on xs because flexDirection was responsive. At size="large" (48px) the labels didn't fit a ~360px mobile column side-by-side, which forced the stack. Drop to size="medium" (40px) on xs and keep flexDirection fixed to row — the two CTAs now sit beside each other on every viewport. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||||
|
import { useTheme } from '@mui/material/styles';
|
||||||
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
||||||
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
|
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
|
||||||
import type { SxProps, Theme } from '@mui/material/styles';
|
import type { SxProps, Theme } from '@mui/material/styles';
|
||||||
@@ -140,6 +142,11 @@ export const PackageDetail = React.forwardRef<HTMLDivElement, PackageDetailProps
|
|||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
|
// CTA buttons stay side-by-side on all viewports; size down on xs so
|
||||||
|
// "Make Arrangement" + "Compare" fit a ~360px mobile column without wrap.
|
||||||
|
const theme = useTheme();
|
||||||
|
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
||||||
|
const ctaSize = isMobile ? 'medium' : 'large';
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
ref={ref}
|
ref={ref}
|
||||||
@@ -206,13 +213,11 @@ export const PackageDetail = React.forwardRef<HTMLDivElement, PackageDetailProps
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* CTA buttons */}
|
{/* CTA buttons — always side-by-side */}
|
||||||
<Box
|
<Box sx={{ display: 'flex', flexDirection: 'row', gap: 1.5, mt: 2.5 }}>
|
||||||
sx={{ display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, gap: 1.5, mt: 2.5 }}
|
|
||||||
>
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size="large"
|
size={ctaSize}
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={arrangeDisabled}
|
disabled={arrangeDisabled}
|
||||||
onClick={onArrange}
|
onClick={onArrange}
|
||||||
@@ -227,7 +232,7 @@ export const PackageDetail = React.forwardRef<HTMLDivElement, PackageDetailProps
|
|||||||
<Button
|
<Button
|
||||||
variant="soft"
|
variant="soft"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
size="large"
|
size={ctaSize}
|
||||||
loading={compareLoading}
|
loading={compareLoading}
|
||||||
endIcon={inCart ? <CheckRoundedIcon /> : undefined}
|
endIcon={inCart ? <CheckRoundedIcon /> : undefined}
|
||||||
onClick={onCompare}
|
onClick={onCompare}
|
||||||
|
|||||||
Reference in New Issue
Block a user