From 5efda5f3b2390ef53888a66a9560374f82dbd517 Mon Sep 17 00:00:00 2001 From: Ari Date: Fri, 27 May 2022 12:25:44 -0400 Subject: [PATCH] using mui select --- .../src/components/ConditionEditor/style.ts | 4 +- webapp/src/components/Inputs/InputList.tsx | 85 ++++++++++++------- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/webapp/src/components/ConditionEditor/style.ts b/webapp/src/components/ConditionEditor/style.ts index c95125d..69bcdb0 100644 --- a/webapp/src/components/ConditionEditor/style.ts +++ b/webapp/src/components/ConditionEditor/style.ts @@ -42,8 +42,8 @@ export const useStyles = createAppUseStyles<{ borderTopRightRadius: 0, borderBottomRightRadius: 0, borderBottomLeftRadius: hasChildren ? 0 : 10, - padding: 10, - minWidth: 30, + minWidth: '10em', + maxWidth: '30em', textOverflow: 'ellipsis', textAlign: 'center', cursor: 'pointer', diff --git a/webapp/src/components/Inputs/InputList.tsx b/webapp/src/components/Inputs/InputList.tsx index 6ffaa71..ffdcee0 100644 --- a/webapp/src/components/Inputs/InputList.tsx +++ b/webapp/src/components/Inputs/InputList.tsx @@ -1,44 +1,71 @@ import { FC } from "react"; -import InputWrapper from "./InputWrapper"; -import { useInputListStyles } from "./styles"; - +import FilledInput from '@mui/material/FilledInput'; +import InputLabel from '@mui/material/InputLabel'; +import MenuItem from '@mui/material/MenuItem'; +import FormControl from '@mui/material/FormControl'; +import Select from '@mui/material/Select'; export interface Props { current: T; options: readonly T[]; onChange: (n: T) => void; + label: string; id?: string; className?: string; - label: string; } export const InputList: FC> = ({ - current, options, onChange, label, - ...selattr + current, + options, + onChange, + label, + id, + className, }) => { const invalidCurrent = !options.includes(current); - const { classes } = useInputListStyles({ - invalidCurrent - }); - return - { + onChange(e.target.value) }} + label={label} + variant="filled" + placeholder={label} > - {options.map((t, i) => )} - {invalidCurrent ? : <>} - - + {options.map((t, i) => ( + + {t} + + ))} + + + // return + // + // }