From 63cb72a2fbd0da55602e5f3280d728904889f8f4 Mon Sep 17 00:00:00 2001 From: Sean Warren <64291729+seankwarren@users.noreply.github.com> Date: Wed, 3 Jan 2024 15:59:42 -0800 Subject: [PATCH] fix/buttonStyle (#56) * fix: button given default nowrap style * feat: save multiselect button given a compact mode --------- Co-authored-by: Timur Bazhirov --- .../components/button/ButtonMultiSelect.tsx | 21 ++++++++++++------- src/theme/components/buttons.ts | 7 ++++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mui/components/button/ButtonMultiSelect.tsx b/src/mui/components/button/ButtonMultiSelect.tsx index 4b78bba7..f8c0f833 100644 --- a/src/mui/components/button/ButtonMultiSelect.tsx +++ b/src/mui/components/button/ButtonMultiSelect.tsx @@ -9,7 +9,6 @@ * Usage: * To use this component, define an array of ButtonConfig objects, each representing a button's configuration. * Pass this array along with a localStorage key (for saving the selected button's state) to the component. - * Optionally, you can also specify the size of the buttons (see https://mui.com/material-ui/react-button/#sizes). * * Example: * ``` @@ -20,6 +19,8 @@ * ]} * localStorageKey="myButtonSelectKey" * size="medium" + * isLoading={false} + * isCompact={true} * /> * ``` */ @@ -46,6 +47,7 @@ type ButtonMultiSelectProps = { size?: "small" | "medium" | "large"; localStorageKey: string; isLoading?: boolean; + isCompact?: boolean; }; function ButtonMultiSelect({ @@ -54,6 +56,7 @@ function ButtonMultiSelect({ size = "small", localStorageKey, isLoading = false, + isCompact = false, }: ButtonMultiSelectProps) { const [anchorEl, setAnchorEl] = useState(null); const [selectedOption, setSelectedOption] = useState(buttonConfigs[0]); @@ -87,11 +90,7 @@ function ButtonMultiSelect({ return ( <> - + }> - {selectedOption.label} + startIcon={ + !isCompact && + }> + {isCompact ? ( + + ) : ( + selectedOption.label + )}