Skip to content

Commit

Permalink
fix: disabledNavigation should disable dropdowns too
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Jul 16, 2024
1 parent 6e9b60a commit 67c9d68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ export function Dropdown(
) {
const { options, className, components, classNames, ...selectProps } = props;

const cssClassRoot = [classNames[UI.DropdownRoot]].join(" ");
const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");

const selectedOption = options?.find(
({ value }) => value === selectProps.value
);
return (
<span className={cssClassRoot}>
<span
data-disabled={selectProps.disabled}
className={classNames[UI.DropdownRoot]}
>
<components.Select className={cssClassSelect} {...selectProps}>
{options?.map(({ value, label, disabled }) => (
<components.Option key={value} value={value} disabled={disabled}>
Expand Down
4 changes: 4 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
align-items: center;
}

.rdp-dropdown_root[data-disabled="true"] .rdp-chevron {
opacity: var(--rdp-disabled-opacity);
}

.rdp-month_caption {
display: flex;
align-content: center;
Expand Down
4 changes: 4 additions & 0 deletions src/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
align-items: center;
}

.dropdown_root[data-disabled="true"] .chevron {
opacity: var(--rdp-disabled-opacity);
}

.month_caption {
display: flex;
align-content: center;
Expand Down

0 comments on commit 67c9d68

Please sign in to comment.