Skip to content

Commit

Permalink
fix: muliselect height
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw committed Dec 20, 2023
1 parent 6ef0671 commit e84ca7b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/components/Multiselect/Common/MultiselectWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ export const MultiselectWrapper = forwardRef<
</Box>
</Box>

{hasItemsToSelect && (
{hasItemsToSelect ? (
<Adornment
size={size}
getToggleButtonProps={getToggleButtonProps}
renderEndAdornment={renderEndAdornment}
disabled={disabled}
/>
) : (
<Box width={5} height={5} />
)}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Default = () => {
<Box __width={300}>
<DynamicMultiselect
value={value}
label="Pick a star wars characters"
// label="Pick a star wars characters"
onChange={(value) => setValue(value)}
options={options}
loading={loading}
Expand Down
8 changes: 2 additions & 6 deletions src/components/Multiselect/Dynamic/DynamicMultiselect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const DynamicMultiselectInner = <T extends Option>(
key={`selected-option-${item.value}-${idx}`}
data-test-id={`selected-option-${item.value}-${idx}`}
paddingX={1.5}
paddingY={0.5}
paddingY="px"
backgroundColor="default1"
borderColor="default1"
borderWidth={1}
Expand All @@ -148,18 +148,14 @@ const DynamicMultiselectInner = <T extends Option>(
index: idx,
})}
>
<Text
variant="caption"
size={size === "small" ? "small" : "medium"}
>
<Text variant="caption" size="small">
{item.label}
</Text>
{!disabled && (
<Text
cursor="pointer"
variant="caption"
size="small"
marginBottom="px"
onClick={(event) => {
event.stopPropagation();
event.preventDefault();
Expand Down
6 changes: 5 additions & 1 deletion src/components/Multiselect/Static/Multiselect.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const meta: Meta<typeof Multiselect> = {
component: Multiselect,
args: {
options,
label: "Pick colors",
// label: "Pick colors",
id: "multiselect",
size: "large",
},
Expand Down Expand Up @@ -196,3 +196,7 @@ export const WithStringAsValues = () => {
</Box>
);
};

export const Empty = () => {
return <Multiselect options={[]} value={[]} />;
};
8 changes: 2 additions & 6 deletions src/components/Multiselect/Static/Multiselect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const MultiselectInner = <T extends Option, V extends Option | string>(
key={`selected-option-${item.value}-${idx}`}
data-test-id={`selected-option-${item.value}-${idx}`}
paddingX={1.5}
paddingY={0.5}
paddingY="px"
backgroundColor="default1"
borderColor="default1"
borderWidth={1}
Expand All @@ -137,18 +137,14 @@ const MultiselectInner = <T extends Option, V extends Option | string>(
index: idx,
})}
>
<Text
variant="caption"
size={size === "small" ? "small" : "medium"}
>
<Text variant="caption" size="small">
{item.label}
</Text>
{!disabled && (
<Text
cursor="pointer"
variant="caption"
size="small"
marginBottom="px"
onClick={(event) => {
event.stopPropagation();
event.preventDefault();
Expand Down
4 changes: 4 additions & 0 deletions src/components/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ export const WithEllipsis = () => {
</Box>
);
};

export const Empty = () => {
return <Select options={options} value="" />;
};

0 comments on commit e84ca7b

Please sign in to comment.