From b0d1ed742e8cc998374e87169eed7e4e4ff37486 Mon Sep 17 00:00:00 2001 From: Mudassar Raza Date: Wed, 3 May 2023 00:03:21 +0500 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Add=20prop=20for=20S?= =?UTF-8?q?QForm=20questions=20to=20support=20rich=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added support for bulleted list for dropdown questions that were converting to plain text before BREAKING CHANGE: 🧨 No --- .../fields/SQFormDropdown/SQFormDropdown.tsx | 18 ++++++++++++++++++ stories/SQFormDropdown.stories.tsx | 14 ++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/components/fields/SQFormDropdown/SQFormDropdown.tsx b/src/components/fields/SQFormDropdown/SQFormDropdown.tsx index 527ba43b..f85c2fe1 100644 --- a/src/components/fields/SQFormDropdown/SQFormDropdown.tsx +++ b/src/components/fields/SQFormDropdown/SQFormDropdown.tsx @@ -7,6 +7,7 @@ import { InputLabel, MenuItem, Select, + Typography, } from '@mui/material'; import {useForm} from '../../../hooks/useForm'; import { @@ -33,6 +34,8 @@ export type SQFormDropdownProps = BaseFieldProps & { onChange?: SelectProps['onChange']; /** Any valid prop for material ui select child component - https://material-ui.com/api/select/#props */ muiFieldProps?: SelectProps; + /** OPTIONAL - Questions that could be asked with the dropdown label */ + questions?: string[]; }; const EMPTY_VALUE = ''; @@ -49,6 +52,15 @@ const classes = { }, fontWeight: 600, }, + typographyStyle: { + color: 'var(--color-granite)', + fontSize: 'var(--base-font-size)', + fontWeight: 'var(--font-weight-normal)', + whiteSpace: 'pre-line', + marginLeft: '25px', + marginTop: '20px', + lineHeight: '15px', + }, }; function SQFormDropdown({ @@ -62,6 +74,7 @@ function SQFormDropdown({ onChange, size = 'auto', muiFieldProps = {}, + questions, }: SQFormDropdownProps): React.ReactElement { const { formikField: {field}, @@ -137,6 +150,11 @@ function SQFormDropdown({ {label} + {questions && ( + + {questions.map((question) => `- ${question}\n`)} + + )}