Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dropdown: Allow header customization #455

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/Dropdown/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ const DefaultTrigger = ({
onClick,
title,
open,
dropdownHeaderClassName,
dropdownArrowClassName,
ArrowComponent = Arrow,
}) => (
<div className={styles.headerWrapper} data-testid="trigger" onClick={onClick}>
<span className={styles.dropdownHeader}>{title}</span>
<span
className={classNames(styles.dropdownHeader, dropdownHeaderClassName)}>
{title}
</span>
<ArrowComponent
onClick={onClick}
open={open}
Expand All @@ -40,6 +44,7 @@ const Dropdown = ({
closeOnItemClick,
customDropdownTrigger,
dropdownArrowClassName,
dropdownHeaderClassName,
style,
...props
}) => {
Expand Down Expand Up @@ -114,6 +119,7 @@ const Dropdown = ({
onClick={handleTriggerClick}
open={dropdownOpenned}
dropdownArrowClassName={dropdownArrowClassName}
dropdownHeaderClassName={dropdownHeaderClassName}
ArrowComponent={Arrow}
/>
{dropdownOpenned &&
Expand All @@ -135,6 +141,7 @@ DefaultTrigger.propTypes = {
title: PropTypes.node,
open: PropTypes.bool,
dropdownArrowClassName: PropTypes.string,
dropdownHeaderClassName: PropTypes.string,
ArrowComponent: PropTypes.func,
};

Expand All @@ -148,6 +155,7 @@ Dropdown.propTypes = {
className: PropTypes.string,
itemsListClassName: PropTypes.string,
dropdownArrowClassName: PropTypes.string,
dropdownHeaderClassName: PropTypes.string,
customDropdownTrigger: PropTypes.func,
title: PropTypes.node,
show: PropTypes.bool,
Expand Down