Skip to content

Commit

Permalink
feat: changing height and present widget better for mobile (#276)
Browse files Browse the repository at this point in the history
Co-authored-by: Eugene Chybisov <18644653+chybisov@users.noreply.github.com>
  • Loading branch information
DNR500 and chybisov authored Aug 14, 2024
1 parent abe9ba0 commit d2f3ec8
Show file tree
Hide file tree
Showing 56 changed files with 1,322 additions and 213 deletions.
2 changes: 1 addition & 1 deletion packages/widget-playground-vite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.png" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="apple-touch-icon" href="/logo192.png" />

<!--
Expand Down
8 changes: 8 additions & 0 deletions packages/widget-playground/src/components/Card/Card.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ export const CardRowContainer = styled(Box)(({ theme }) => ({
padding: theme.spacing(2),
}));

export const CardRowColumn = styled(Box)(({ theme }) => ({
display: 'flex',
width: '100%',
flexDirection: 'column',
alignItems: 'flex-start',
padding: 0,
}));

export const CardValue = styled(Typography)({
lineHeight: '1.25',
fontWeight: 500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { safe6DigitHexColor } from '../../../utils';
import { ExpandableCard } from '../../Card';
import {
CapitalizeFirstLetter,
ColorControlContainer,
ColorInput,
ColorSelectorContainer,
ColorSwatch,
ColorSwatches,
} from './DesignControls.style';
Expand Down Expand Up @@ -57,15 +57,15 @@ const ColorSelector = ({
const { setColor } = useConfigActions();

return colorValue ? (
<ColorSelectorContainer {...rest}>
<ColorControlContainer {...rest}>
<CapitalizeFirstLetter>{colorName}</CapitalizeFirstLetter>
<ColorInput
aria-label={`${colorName} color selection`}
type="color"
value={safe6DigitHexColor(colorValue).toUpperCase()}
onChange={(e) => setColor(colorPath, e.target.value)}
/>
</ColorSelectorContainer>
</ColorControlContainer>
) : null;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { autocompleteClasses } from '@mui/material/Autocomplete';
import { inputBaseClasses } from '@mui/material/InputBase';
import { alpha, styled } from '@mui/material/styles';
import { getCardFieldsetBackgroundColor } from '../../../utils';
import { CardRowContainer } from '../../Card';
import { autocompletePopperZIndex } from '../DrawerControls.style';

export const TabButtonsContainer = styled(Box)(({ theme }) => ({
Expand Down Expand Up @@ -100,6 +101,31 @@ export const TabCustomInput = styled(InputBase)<TabButtonProps>(({
};
});

export const Input = styled(InputBase)(({ theme }) => {
return {
minHeight: 56,
width: '100%',

[`.${inputBaseClasses.input}`]: {
minHeight: 56,
width: '100%',
padding: 0,
textAlign: 'center',
'&::placeholder': {
fontSize: '1rem',
fontWeight: 400,
opacity: 0.5,
},
'&::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
display: 'none',
},
},
backgroundColor: getCardFieldsetBackgroundColor(theme),
borderRadius: theme.shape.borderRadiusSecondary,
boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
};
});

export const ColorSwatches = styled(Box)(({ theme }) => ({
display: 'flex',
justifyContent: 'flex-end',
Expand All @@ -121,7 +147,7 @@ export const ColorSwatch = styled(
content: '" "',
}));

export const ColorSelectorContainer = styled(Box)(({ theme }) => ({
export const ControlContainer = styled(Box)(({ theme }) => ({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
Expand All @@ -130,10 +156,26 @@ export const ColorSelectorContainer = styled(Box)(({ theme }) => ({
theme.shape.borderRadius,
theme.shape.borderRadiusSecondary,
),
padding: theme.spacing(0.5),
paddingLeft: theme.spacing(2.5),
padding: theme.spacing(0.5, 2.5),
gap: theme.spacing(0.5),
height: '3.5rem',
minHeight: theme.spacing(7),
}));

export const ColorControlContainer = styled(ControlContainer)(({ theme }) => ({
height: theme.spacing(7),
paddingRight: theme.spacing(0.5),
}));

export const PlaygroundControlsContainer = styled(Box)(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(1),
marginTop: theme.spacing(1),
}));

export const ControlRowContainer = styled(CardRowContainer)(({ theme }) => ({
paddingLeft: 0,
paddingRight: 0,
}));

export const ColorInput = styled(InputBase)<InputBaseProps>(
Expand Down
Loading

0 comments on commit d2f3ec8

Please sign in to comment.