-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
'use client' | ||
import { useState } from 'react' | ||
import { Button } from 'components/buttons' | ||
import { HiCog8Tooth } from 'react-icons/hi2' | ||
import { ModalNormal } from 'components/modals' | ||
|
||
export default function Settings () { | ||
const [show, setShow] = useState<boolean>(false) | ||
|
||
const handleOnClick = () => { | ||
setShow(true) | ||
} | ||
|
||
return ( | ||
<> | ||
<Button | ||
className="w-full" | ||
className="w-full gap-4 py-3" | ||
type="button" | ||
color="transparent" | ||
onClick={handleOnClick} | ||
> | ||
<div> | ||
|
||
</div> | ||
<HiCog8Tooth | ||
className="w-8 h-8" | ||
/> | ||
|
||
<span>Settings</span> | ||
</Button> | ||
|
||
<ModalNormal show={show} setShow={setShow}> | ||
asdasd | ||
|
||
</ModalNormal> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use client' | ||
import type { ReactNode } from 'react' | ||
import { HiXMark } from 'react-icons/hi2' | ||
|
||
interface Props { | ||
className?: string | ||
show: boolean | ||
setShow: (value: boolean | ((prev: boolean) => boolean)) => void | ||
children: ReactNode | ||
} | ||
|
||
export default function Normal ({ | ||
className = '', | ||
show, | ||
setShow, | ||
children | ||
}: Props) { | ||
const handleOnClickX = () => { | ||
setShow(false) | ||
} | ||
|
||
const handleOnMouseDown = (e: any) => { | ||
if ( | ||
!show || | ||
( | ||
e.currentTarget !== e.target && | ||
e.currentTarget !== e.target.parentElement | ||
) | ||
) return | ||
|
||
setShow(false) | ||
} | ||
|
||
return ( | ||
<div | ||
className={`fixed inset-0 bg-black bg-opacity-50 grid place-items-center transition-all ${show ? 'opacity-100 visible' : 'opacity-0 invisible'}`} | ||
onMouseDown={handleOnMouseDown} | ||
> | ||
<div className="w-full p-8 max-h-screen overflow-y-auto"> | ||
<div className="max-w-xl mx-auto bg-stone-900 rounded-md"> | ||
<div className="flex justify-end p-4 border-b border-stone-700"> | ||
<button | ||
type="button" | ||
onClick={handleOnClickX} | ||
> | ||
<HiXMark | ||
className="w-7 h-7" | ||
/> | ||
</button> | ||
</div> | ||
|
||
<div className={`p-4 ${className}`}> | ||
{children} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as ModalNormal } from './Normal' |