Skip to content

Commit

Permalink
feat: dark dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
anukulpandey committed May 17, 2024
1 parent d39bbef commit 1620c92
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/ui-kit/components/atoms/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ export interface Props {
onClose: (...args: any[]) => any,
position?: "top" | "bottomRight" | "bottomLeft" | "topRight" | "topLeft",
className?: string,
isDarkMode?:boolean,
children?: any
}

const Dropdown = ({
isOpen,
stayOpen,
isDarkMode,
onClose,
position,
children,
Expand Down Expand Up @@ -51,14 +53,14 @@ const Dropdown = ({
>
<CSSTransition
in={isOpen}
className='uik-dropdown__dropdown'
className={`uik-dropdown__dropdown ${isDarkMode?'dark':''}`}
nodeRef={dropdown}
timeout={150}
unmountOnExit
>
<div
ref={dropdown}
className='uik-dropdown__dropdown'
className={`uik-dropdown__dropdown ${isDarkMode?'dark':''}`}
>
{ getChildren }
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/ui-kit/components/atoms/Dropdown/DropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Icon from './../Icon';
export interface Props {
text?: string,
icon?: any,
isDarkMode?:boolean,
onClick?: (...args: any[]) => any,
className?: string,
children?: any
Expand All @@ -12,6 +13,7 @@ const DropdownItem = ({
text,
icon,
onClick,
isDarkMode,
children,
className
}: Props): JSX.Element => (
Expand All @@ -32,7 +34,7 @@ const DropdownItem = ({
/>
</div>
}
<span className="uik-dropdown__item-text">{children}{text}</span>
<span className={`uik-dropdown__item-text ${isDarkMode?'dark':''}`}>{children}{text}</span>
</button>
);

Expand Down
21 changes: 19 additions & 2 deletions src/ui-kit/styles/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
padding: 8px;
margin: 4px 0;

&.dark{
background: #38393f;
color: white ;

&:hover{
color: black;
}
}

&.enter {
opacity: 0;
transform: scale(0.8);
Expand Down Expand Up @@ -83,11 +92,19 @@
font-weight: 600;
color: var(--text);
user-select: none;

&.dark{
color: white;
&:hover{
color: black!important;
}
}
}

&:hover {
&:hover {
transition: none;
background-color: var(--border-color-light);
color: black!important;
cursor: pointer;

.uik-dropdown__item-icon {
Expand All @@ -96,7 +113,7 @@
}
}
}

&:active {
background-color: var(--border-color);
}
Expand Down

0 comments on commit 1620c92

Please sign in to comment.