[Update] Config Window: Setting Box: DropdownMenu: Adjust design. add arrow icon that can toggle and border-radius.
Also change the open dropdown menu function to the toggle function.
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
import styles from "./DropdownMenu.module.scss";
|
||||
|
||||
import clsx from "clsx";
|
||||
|
||||
import ArrowLeftSvg from "@images/arrow_left.svg?react";
|
||||
import { useIsOpenedDropdownMenu } from "@store";
|
||||
|
||||
export const DropdownMenu = (props) => {
|
||||
|
||||
const { updateIsOpenedDropdownMenu, currentIsOpenedDropdownMenu } = useIsOpenedDropdownMenu();
|
||||
const openDropdownMenu = () => {
|
||||
updateIsOpenedDropdownMenu(props.dropdown_id);
|
||||
const toggleDropdownMenu = () => {
|
||||
if (currentIsOpenedDropdownMenu === props.dropdown_id) {
|
||||
updateIsOpenedDropdownMenu("");
|
||||
} else {
|
||||
updateIsOpenedDropdownMenu(props.dropdown_id);
|
||||
}
|
||||
};
|
||||
|
||||
const selectValue = (key) => {
|
||||
@@ -27,17 +31,20 @@ export const DropdownMenu = (props) => {
|
||||
[styles["is_loading"]]: (props.state === "loading") ? true : false
|
||||
});
|
||||
|
||||
const arrow_class_names = clsx(styles["arrow_left_svg"], {
|
||||
[styles["is_opened"]]: (currentIsOpenedDropdownMenu === props.dropdown_id) ? true : false
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={dropdown_toggle_button_class_name} onClick={openDropdownMenu}>
|
||||
<div className={dropdown_toggle_button_class_name} onClick={toggleDropdownMenu}>
|
||||
{(props.state === "loading")
|
||||
? <p className={styles.dropdown_selected_text}>Loading...</p>
|
||||
: <p className={styles.dropdown_selected_text}>{props.list[props.selected_id]}</p>
|
||||
}
|
||||
{(props.state === "loading")
|
||||
? <span className={styles.loader}></span>
|
||||
: null
|
||||
: <ArrowLeftSvg className={arrow_class_names} />
|
||||
}
|
||||
</div>
|
||||
<div className={dropdown_content_wrapper_class_name}>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
position: relative;
|
||||
background-color: var(--dark_925_color);
|
||||
min-width: 20rem;
|
||||
padding: 0.6rem 0.8rem;
|
||||
padding: 0.6rem 1rem;
|
||||
cursor: pointer;
|
||||
border-radius: 0.4rem;
|
||||
&:hover {
|
||||
background-color: var(--dark_850_color);
|
||||
}
|
||||
@@ -47,6 +49,7 @@
|
||||
.value_button {
|
||||
background-color: var(--dark_875_color);
|
||||
padding: 0.8rem;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: var(--dark_800_color);
|
||||
}
|
||||
@@ -61,4 +64,15 @@
|
||||
|
||||
.loader {
|
||||
@include loader(2rem, 0.2rem, right, 0);
|
||||
}
|
||||
|
||||
.arrow_left_svg {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
transform: translate(-50%, -50%) rotate(-90deg);
|
||||
width: 1.4rem;
|
||||
&.is_opened {
|
||||
transform: translate(-50%, -50%) rotate(90deg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user