Made maxwidth to be default 100% and if the number is provided then we truncate.
This commit is contained in:
1 parent
ec3704552f
commit
5c0c33a339
2 files changed
+11
-8
No files matched your search
@@ -50,7 +50,7 @@ const Select = ({
|
|||||||
sx,
|
sx,
|
||||||
name = "",
|
name = "",
|
||||||
labelControlSpacing = 2,
|
labelControlSpacing = 2,
|
||||||
maxWidthValue = 250,
|
maxWidth,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const itemStyles = {
|
const itemStyles = {
|
||||||
@@ -60,6 +60,13 @@ const Select = ({
|
|||||||
margin: theme.spacing(2),
|
margin: theme.spacing(2),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const responsiveMaxWidth = {
|
||||||
|
xs: `${maxWidth * 0.5}px`,
|
||||||
|
sm: `${maxWidth * 0.75}px`,
|
||||||
|
md: `${maxWidth * 0.9}px`,
|
||||||
|
lg: `${maxWidth}px`,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(labelControlSpacing)}
|
gap={theme.spacing(labelControlSpacing)}
|
||||||
@@ -88,12 +95,7 @@ const Select = ({
|
|||||||
sx={{
|
sx={{
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
minWidth: "125px",
|
minWidth: "125px",
|
||||||
maxWidth: {
|
...(maxWidth && { maxWidth: responsiveMaxWidth }),
|
||||||
xs: `${maxWidthValue * 0.5}px`,
|
|
||||||
sm: `${maxWidthValue * 0.75}px`,
|
|
||||||
md: `${maxWidthValue * 0.9}px`,
|
|
||||||
lg: `${maxWidthValue}`,
|
|
||||||
},
|
|
||||||
"& fieldset": {
|
"& fieldset": {
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
borderColor: theme.palette.primary.lowContrast,
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
@@ -169,7 +171,7 @@ Select.propTypes = {
|
|||||||
onBlur: PropTypes.func,
|
onBlur: PropTypes.func,
|
||||||
sx: PropTypes.object,
|
sx: PropTypes.object,
|
||||||
labelControlSpacing: PropTypes.number,
|
labelControlSpacing: PropTypes.number,
|
||||||
maxWidthValue: PropTypes.number,
|
maxWidth: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Select;
|
export default Select;
|
||||||
@@ -52,6 +52,7 @@ const OptionsHeader = ({
|
|||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.primary.main,
|
||||||
color: theme.palette.primary.contrastTextSecondary,
|
color: theme.palette.primary.contrastTextSecondary,
|
||||||
}}
|
}}
|
||||||
|
maxWidth={250}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack {...stackStyles}>
|
<Stack {...stackStyles}>
|
||||||
|
|||||||
Reference in new issue
Block a user