Skip to content

Commit

Permalink
fix: multiselect overlow (#93)
Browse files Browse the repository at this point in the history
* fix(multiselect): add overflow ellipsis
* fix chevron size
  • Loading branch information
petermakowski authored Jan 26, 2024
1 parent 0912579 commit 6d904ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 13 additions & 2 deletions src/lib/components/MultiSelect/MultiSelect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
margin-top: 0;
}

.multi-select__condensed-text {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
margin-right: $sph--large + $sph--x-small;
}

.multi-select__input {
position: relative;
cursor: pointer;
Expand Down Expand Up @@ -124,13 +131,17 @@ button.multi-select__select-button {
z-index: 0;

&::after {
position: absolute;
right: $sph--small;
top: 50%;

@extend %icon;
@include vf-icon-chevron($color-mid-dark);
@include vf-transition($property: transform, $duration: fast);

content: '';
margin-left: $sph--large;
transform: rotate(-180deg);
transform: translateY(-50%) rotate(-180deg);
}

&[aria-expanded='true'] {
Expand All @@ -139,7 +150,7 @@ button.multi-select__select-button {

&[aria-expanded='false'] {
&::after {
transform: rotate(0);
transform: translateY(-50%) rotate(0);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/lib/components/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,11 @@ export const MultiSelect: React.FC<MultiSelectProps> = ({
onFocus={() => setIsDropdownOpen(true)}
onClick={() => setIsDropdownOpen(true)}
>
{selectedItems.length > 0
? selectedItemsLabel
: placeholder ?? "Select items"}
<span className="multi-select__condensed-text">
{selectedItems.length > 0
? selectedItemsLabel
: placeholder ?? "Select items"}
</span>
</button>
)}
<MultiSelectDropdown
Expand Down

0 comments on commit 6d904ab

Please sign in to comment.