aboutsummaryrefslogtreecommitdiff
path: root/packages/components/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/components/src')
-rw-r--r--packages/components/src/components/Dropdown/Dropdown.tsx30
1 files changed, 11 insertions, 19 deletions
diff --git a/packages/components/src/components/Dropdown/Dropdown.tsx b/packages/components/src/components/Dropdown/Dropdown.tsx
index 0953f412c..b9b6f01b8 100644
--- a/packages/components/src/components/Dropdown/Dropdown.tsx
+++ b/packages/components/src/components/Dropdown/Dropdown.tsx
@@ -99,22 +99,14 @@ export const Dropdown = (props: IDropdownProps) => {
background: background ?? color,
};
- const getCaretDirection = (active: boolean, placement: Placement = 'left'): JSX.Element => {
- if (iconProvider) return iconProvider(active, placement);
- switch (placement) {
- case 'bottom':
- if (active) return <FaCaretUp />;
- return <FaCaretDown />;
- case 'right':
- if (active) return <FaCaretLeft />;
- return <FaCaretRight />;
- case 'top':
- if (active) return <FaCaretDown />;
- return <FaCaretUp />;
- default:
- if (active) return <FaCaretUp />;
- return <FaCaretDown />;
- }
+ const getCaretDirection = (isActive: boolean, caretPlacement: Placement = 'left'): JSX.Element => {
+ if (iconProvider) return iconProvider(isActive, caretPlacement);
+ switch (caretPlacement) {
+ default:
+ case 'bottom':return isActive ? <FaCaretUp />: <FaCaretDown />;
+ case 'right': return isActive ? <FaCaretLeft /> : <FaCaretRight />;
+ case 'top': return isActive ? <FaCaretDown />: <FaCaretUp />;
+ } // prettier-ignore
};
const getToggle = () => {
@@ -143,9 +135,9 @@ export const Dropdown = (props: IDropdownProps) => {
}
};
- const setActiveChanged = (active: boolean) => {
- setActive(active);
- props.activeChanged?.(active);
+ const setActiveChanged = (isActive: boolean) => {
+ setActive(isActive);
+ props.activeChanged?.(isActive);
};
const dropdown: JSX.Element = (