From 2ba417fa5f43ef2f679ae9464f68cbe28f8e1c2e Mon Sep 17 00:00:00 2001 From: Viktor Riabkov Date: Thu, 4 Apr 2024 15:42:06 +0800 Subject: [PATCH] Fix mobile version of matrix grid --- src/entities/activity/ui/items/Matrix/MatrixCell.tsx | 2 ++ .../items/Matrix/MatrixMultiSelectItem/CheckboxButton.tsx | 6 +++++- .../ui/items/Matrix/MatrixMultiSelectItem/CheckboxGrid.tsx | 2 +- .../ui/items/Matrix/MatrixSingleSelectItem/RadioButton.tsx | 2 +- .../ui/items/Matrix/MatrixSingleSelectItem/RadioGrid.tsx | 2 +- src/shared/ui/Items/SelectBase/SelectBaseBox.tsx | 3 ++- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/entities/activity/ui/items/Matrix/MatrixCell.tsx b/src/entities/activity/ui/items/Matrix/MatrixCell.tsx index 69e8ff645..0e28b475d 100644 --- a/src/entities/activity/ui/items/Matrix/MatrixCell.tsx +++ b/src/entities/activity/ui/items/Matrix/MatrixCell.tsx @@ -15,6 +15,7 @@ export const MatrixCell = ({ children, isRowLabel }: Props) => { return ( { width={isRowLabel ? rowLabelWidth : '100%'} minWidth={lessThanTarget ? '70px' : '142px'} maxWidth="400px" + data-testid="matrix-cell" > {children} diff --git a/src/entities/activity/ui/items/Matrix/MatrixMultiSelectItem/CheckboxButton.tsx b/src/entities/activity/ui/items/Matrix/MatrixMultiSelectItem/CheckboxButton.tsx index dd0516db1..8a2898c79 100644 --- a/src/entities/activity/ui/items/Matrix/MatrixMultiSelectItem/CheckboxButton.tsx +++ b/src/entities/activity/ui/items/Matrix/MatrixMultiSelectItem/CheckboxButton.tsx @@ -3,6 +3,7 @@ import Box from '@mui/material/Box'; import { MatrixCell } from '../MatrixCell'; import { CheckboxItem, SelectBaseBox } from '~/shared/ui'; +import { useCustomMediaQuery } from '~/shared/utils'; type Props = { id: string; @@ -13,14 +14,17 @@ type Props = { }; export const CheckboxButton = ({ id, isChecked, text, onChange }: Props) => { + const { lessThanSM } = useCustomMediaQuery(); + return ( - + { return ( - + {rows.map((row, rowI) => { diff --git a/src/entities/activity/ui/items/Matrix/MatrixSingleSelectItem/RadioButton.tsx b/src/entities/activity/ui/items/Matrix/MatrixSingleSelectItem/RadioButton.tsx index 83f28f19b..aed774a1a 100644 --- a/src/entities/activity/ui/items/Matrix/MatrixSingleSelectItem/RadioButton.tsx +++ b/src/entities/activity/ui/items/Matrix/MatrixSingleSelectItem/RadioButton.tsx @@ -14,7 +14,7 @@ type Props = { export const RadioButton = ({ id, text, isChecked, onChange }: Props) => { return ( - + { return ( - + {rows.map((row, rowI) => { diff --git a/src/shared/ui/Items/SelectBase/SelectBaseBox.tsx b/src/shared/ui/Items/SelectBase/SelectBaseBox.tsx index 27d9e4966..b893a0382 100644 --- a/src/shared/ui/Items/SelectBase/SelectBaseBox.tsx +++ b/src/shared/ui/Items/SelectBase/SelectBaseBox.tsx @@ -5,6 +5,7 @@ import Box from '@mui/material/Box'; import { Theme } from '~/shared/constants'; type Props = PropsWithChildren<{ + padding?: string; justifyContent?: | 'flex-start' | 'center' @@ -40,7 +41,7 @@ export const SelectBaseBox = (props: Props) => { gap="12px" className="response-option" borderRadius="12px" - padding="16px" + padding={props.padding ? props.padding : '16px'} border={`2px solid ${borderColor}`} bgcolor={props.color ? props.color : backgroundColor} onClick={props.onHandleChange}