frontend: add close button to color picker

This commit is contained in:
Kentai Radiquum 2024-04-21 05:49:46 +05:00
parent 79782b4228
commit 6b88601417
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
2 changed files with 38 additions and 22 deletions

View file

@ -34,14 +34,21 @@ export const App = (props) => {
return ( return (
<body> <body>
<div>
<NavigationRail <NavigationRail
colorPicker={colorPicker} colorPicker={colorPicker}
setColorPicker={setColorPicker} setColorPicker={setColorPicker}
/> />
<main className="responsive"> {colorPicker && (
{colorPicker && <ColorPicker mode={mode} theme={theme} />} <ColorPicker
{props.children} mode={mode}
</main> theme={theme}
colorPicker={colorPicker}
setColorPicker={setColorPicker}
/>
)}
</div>
<main className="responsive">{props.children}</main>
</body> </body>
); );
}; };

View file

@ -1,7 +1,7 @@
"use client"; "use client";
import { useState } from "react"; import { useState } from "react";
import Styles from "./ColorPicker.module.css" import Styles from "./ColorPicker.module.css";
export const ColorPicker = (props) => { export const ColorPicker = (props) => {
const colors = [ const colors = [
@ -21,7 +21,7 @@ export const ColorPicker = (props) => {
return ( return (
<dialog className="active"> <dialog className="active">
<h5>Theme Select</h5> <h5>Выбор темы</h5>
<div className="grid center-align"> <div className="grid center-align">
{colors.map((item) => { {colors.map((item) => {
return ( return (
@ -34,6 +34,7 @@ export const ColorPicker = (props) => {
})} })}
</div> </div>
<div className="medium-divider"></div> <div className="medium-divider"></div>
<nav>
<button <button
className={`circle small transparent`} className={`circle small transparent`}
onClick={() => { onClick={() => {
@ -43,6 +44,14 @@ export const ColorPicker = (props) => {
> >
{mode == "light" ? <i>dark_mode</i> : <i>light_mode</i>} {mode == "light" ? <i>dark_mode</i> : <i>light_mode</i>}
</button> </button>
<span className="max"></span>
<button
className={`circle small transparent `}
onClick={() => props.setColorPicker(!props.colorPicker)}
>
<i>close</i>
</button>
</nav>
</dialog> </dialog>
); );
}; };