Skip to content

Commit e14ca8b

Browse files
spaceokasperbirch1
authored andcommitted
Add possibility for disabling dropdown options
Right now we need it for facet grouping
1 parent 6ad33f2 commit e14ca8b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/stories/Library/dropdown/Dropdown.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type DropdownItem = {
22
title: string;
33
href?: string;
4+
disabled?: boolean;
45
};
56

67
export type DropdownProps = {
@@ -50,8 +51,13 @@ export const Dropdown: React.FC<DropdownProps> = ({
5051
return (
5152
<div className={`dropdown ${classNames || ""}`}>
5253
<select className="dropdown__select" aria-label={ariaLabel}>
53-
{list.map(({ title }, index) => (
54-
<option key={index} className="dropdown__option" value={title}>
54+
{list.map(({ title, disabled }, index) => (
55+
<option
56+
key={index}
57+
className="dropdown__option"
58+
value={title}
59+
disabled={disabled !== undefined ? disabled : false}
60+
>
5561
{title}
5662
</option>
5763
))}

src/stories/Library/search-result-page/FacetLine.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const FacetLine: FC<FacetLineProps> = ({ items }) => {
3434
<li className="facet-line__item">
3535
<Dropdown
3636
ariaLabel="Choose periodical year"
37-
list={[{ title }, ...terms]}
37+
list={[{ title, disabled: true }, ...terms]}
3838
arrowIcon="chevron"
3939
classNames="dropdown--grey-borders"
4040
/>

0 commit comments

Comments
 (0)