Skip to content

Commit

Permalink
FIXUP: Dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Feb 27, 2022
1 parent c898d9d commit 4d44f22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 5 additions & 9 deletions packages/ui/src/ui/dropdown/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { Icon } from '../icon';
import css from './dropdown.module.css';

export const Dropdown = (props) => {
const { className, label, ariaLabel, glyph, activeLabel, children } = props;
const rootClassName = cx(css.root, activeLabel && css.activeLabel, className);
const { className, label, ariaLabel, glyph, children } = props;
const rootClassName = cx(css.root, className);

const menuState = useMenuState();
const baseId = process.env.NODE_ENV === 'test' && 'id-test';

return (
<>
<div className={rootClassName}>
<MenuButton
state={menuState}
className={rootClassName}
className={css.button}
tabIndex={null}
{...(baseId && { id: baseId })}
>
Expand All @@ -42,7 +42,7 @@ export const Dropdown = (props) => {
})
: children}
</Menu>
</>
</div>
);
};

Expand All @@ -51,7 +51,6 @@ Dropdown.defaultProps = {
label: null,
ariaLabel: '',
glyph: null,
activeLabel: false,
};

Dropdown.propTypes = {
Expand All @@ -70,9 +69,6 @@ Dropdown.propTypes = {
/** Dropdown open state */
open: PropTypes.bool.isRequired,

/** Active label flag */
activeLabel: PropTypes.bool,

/** Content */
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired,
};
14 changes: 7 additions & 7 deletions packages/ui/src/ui/dropdown/dropdown.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.root {
display: inline-block;
}

.button {
background: none;
border: none;
padding: 0;
Expand All @@ -18,9 +22,9 @@
color: var(--color-text-light);
}

.root:hover,
.root:focus,
.root:active {
.button:hover,
.button:focus,
.button:active {
outline: none;
box-shadow: 0 0 var(--space-xxxsmall) var(--color-shadow);
border-color: var(--color-outline-dark);
Expand All @@ -44,10 +48,6 @@
box-shadow: 0 2px var(--space-xsmall) var(--color-shadow);
}

.activeLabel .label {
color: var(--color-text);
}

.menuItem {
display: block;
appearance: none;
Expand Down

0 comments on commit 4d44f22

Please sign in to comment.