Integrated the ColorDialog into the Header.jsx
This commit is contained in:
parent
83a639840d
commit
917dec35d0
@ -3,18 +3,23 @@ import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
|||||||
import {faBars, faGear} from "@fortawesome/free-solid-svg-icons";
|
import {faBars, faGear} from "@fortawesome/free-solid-svg-icons";
|
||||||
import {getByPath} from "@/common/routes";
|
import {getByPath} from "@/common/routes";
|
||||||
import {useLocation} from "react-router-dom";
|
import {useLocation} from "react-router-dom";
|
||||||
|
import {useState} from "react";
|
||||||
|
import ColorDialog from "@/common/components/Header/components/ColorDialog/index.js";
|
||||||
|
|
||||||
export const Header = ({open, setOpen}) => {
|
export const Header = ({open, setOpen, color, setColor}) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const path = getByPath(location.pathname);
|
const path = getByPath(location.pathname);
|
||||||
|
|
||||||
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="header">
|
<div className="header">
|
||||||
|
{dialogOpen && <ColorDialog onClose={() => setDialogOpen(false)} color={color} setColor={setColor}/>}
|
||||||
<div className="header-left">
|
<div className="header-left">
|
||||||
{!open && <FontAwesomeIcon icon={faBars} className="open-menu" onClick={() => setOpen(true)}/>}
|
{!open && <FontAwesomeIcon icon={faBars} className="open-menu" onClick={() => setOpen(true)}/>}
|
||||||
<h1>{path?.category} / <span>{path?.name}</span></h1>
|
<h1>{path?.category} / <span>{path?.name}</span></h1>
|
||||||
</div>
|
</div>
|
||||||
<FontAwesomeIcon icon={faGear} />
|
<FontAwesomeIcon icon={faGear} onClick={() => setDialogOpen(true)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
Reference in New Issue
Block a user