From 248660ff30718ee84d668a02db68c158f4d97ec4 Mon Sep 17 00:00:00 2001 From: Ari Date: Tue, 19 Apr 2022 22:14:49 -0400 Subject: [PATCH] input multi select styling bug --- .../components/Inputs/InputMultiSelect.tsx | 48 +++++++++---------- webapp/src/components/Inputs/styles.ts | 15 ++++-- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/webapp/src/components/Inputs/InputMultiSelect.tsx b/webapp/src/components/Inputs/InputMultiSelect.tsx index 37bb847..382f0b6 100644 --- a/webapp/src/components/Inputs/InputMultiSelect.tsx +++ b/webapp/src/components/Inputs/InputMultiSelect.tsx @@ -32,35 +32,35 @@ export default function InputMultiSelect({ }); - return
+ return
{selected.length} -
-
- {options.map((v, i) => { - const selectedCount = selected.indexOf(i); - const isSelected = selectedCount > -1; - return
{ - if (!isSelected) { - if (!maxedOut) { - onChange([...selected, i]) +
+ {options.map((v, i) => { + const selectedCount = selected.indexOf(i); + const isSelected = selectedCount > -1; + return
{ + if (!isSelected) { + if (!maxedOut) { + onChange([...selected, i]) + } + } else { + onChange( + selected.slice(0, selectedCount).concat(selected.slice(selectedCount + 1)) + ) } - } else { - onChange( - selected.slice(0, selectedCount).concat(selected.slice(selectedCount + 1)) - ) - } - }} - > - {v} - {selectedCount} -
- })} + }} + > + {v} + {selectedCount} +
+ })} +
} diff --git a/webapp/src/components/Inputs/styles.ts b/webapp/src/components/Inputs/styles.ts index 869fb14..017c29d 100644 --- a/webapp/src/components/Inputs/styles.ts +++ b/webapp/src/components/Inputs/styles.ts @@ -131,10 +131,12 @@ export const useInputMultiSelectStyles = createAppUseStyles<{ }>(theme => { const styles = commonInputStyle(theme); return { + root: { + }, input: { ...styles.input, - cursor: 'pointer', position: 'relative', + cursor: 'pointer', display: 'flex', gap: '1em', @@ -156,14 +158,19 @@ export const useInputMultiSelectStyles = createAppUseStyles<{ padding: '0em 0.4em' })), optionsWrapper: (({ open }) => ({ + background: theme.primary, + borderColor: theme.primaryAccent, + borderStyle: "solid", + borderWidth: 1, position: 'absolute', display: open ? 'flex' : 'none', flexDirection: 'column', gap: '0.25em', - left: '1em', - top: '4em', - height: '100%', + left: '0', + top: 'calc(100% + 0.25em)', userSelect: 'none', + overflow: 'hidden', + width: "100%", })), arrow: (({ open }) => ({ position: 'absolute',