-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve MultiSelect component (#1556)
* Improve MultiSelect component * Improve search input styling
- Loading branch information
Showing
7 changed files
with
154 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@import 'src/constants'; | ||
|
||
@import 'src/mixins'; | ||
|
||
.label { | ||
margin-bottom: 0.25rem; | ||
font-weight: 700; | ||
} | ||
|
||
.box { | ||
background: $grey-4; | ||
border-radius: 5px; | ||
padding: 0.5rem; | ||
|
||
@include theme-dark { | ||
background: $black-2; | ||
} | ||
} | ||
|
||
.inner { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.125rem; | ||
overflow-y: auto; | ||
height: 14rem; | ||
|
||
@include for-desktop-up { | ||
height: 26rem; | ||
} | ||
} | ||
|
||
.button { | ||
display: block; | ||
width: 100%; | ||
text-align: left; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Button } from '~/Components'; | ||
import type { ButtonTheme } from '~/Components/Button'; | ||
import type { DropDownOption } from '~/Components/Dropdown/Dropdown'; | ||
import styles from './SelectBox.module.scss'; | ||
|
||
type Props<T> = { | ||
items: DropDownOption<T>[]; | ||
label?: string; | ||
onItemClick?: (item: DropDownOption<T>) => void; | ||
itemButtonTheme?: ButtonTheme; | ||
}; | ||
|
||
export function SelectBox<T>({ items, label, onItemClick, itemButtonTheme = 'samf' }: Props<T>) { | ||
return ( | ||
<div className={styles.container}> | ||
{label && <div className={styles.label}>{label}</div>} | ||
<div className={styles.box}> | ||
<div className={styles.inner}> | ||
{items.map((item, i) => ( | ||
<Button | ||
type="button" | ||
// biome-ignore lint/suspicious/noArrayIndexKey: no other unique value available | ||
key={i} | ||
onClick={() => onItemClick?.(item)} | ||
theme={itemButtonTheme} | ||
className={styles.button} | ||
> | ||
{item.label} | ||
</Button> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters