mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 22:53:59 +01:00
feat: about menu
This commit is contained in:
parent
03972ba0a2
commit
db81221e2d
16
src/assets/icons/AboutIcon.tsx
Normal file
16
src/assets/icons/AboutIcon.tsx
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const AboutIcon = () => {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
viewBox='0 0 512 512'
|
||||||
|
className='h-4 w-4'
|
||||||
|
fill='white'
|
||||||
|
>
|
||||||
|
<path d='M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z' />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AboutIcon;
|
38
src/components/AboutMenu/AboutMenu.tsx
Normal file
38
src/components/AboutMenu/AboutMenu.tsx
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import PopupModal from '@components/PopupModal';
|
||||||
|
import AboutIcon from '@icon/AboutIcon';
|
||||||
|
|
||||||
|
const AboutMenu = () => {
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<a
|
||||||
|
className='flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm'
|
||||||
|
onClick={() => {
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<AboutIcon />
|
||||||
|
</div>
|
||||||
|
About
|
||||||
|
</a>
|
||||||
|
{isModalOpen && (
|
||||||
|
<PopupModal
|
||||||
|
title='About'
|
||||||
|
setIsModalOpen={setIsModalOpen}
|
||||||
|
cancelButton={false}
|
||||||
|
>
|
||||||
|
<div className='p-6 border-b border-gray-200 dark:border-gray-600'>
|
||||||
|
<div className='min-w-fit text-gray-900 dark:text-gray-300 text-sm'>
|
||||||
|
Description
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</PopupModal>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AboutMenu;
|
1
src/components/AboutMenu/index.ts
Normal file
1
src/components/AboutMenu/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export { default } from './AboutMenu';
|
|
@ -7,10 +7,12 @@ import Logout from './Logout';
|
||||||
import Me from './Me';
|
import Me from './Me';
|
||||||
import ThemeSwitcher from './ThemeSwitcher';
|
import ThemeSwitcher from './ThemeSwitcher';
|
||||||
import Updates from './Updates';
|
import Updates from './Updates';
|
||||||
|
import AboutMenu from '@components/AboutMenu';
|
||||||
|
|
||||||
const MenuOptions = () => {
|
const MenuOptions = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<AboutMenu />
|
||||||
<ClearConversation />
|
<ClearConversation />
|
||||||
<Api />
|
<Api />
|
||||||
<ThemeSwitcher />
|
<ThemeSwitcher />
|
||||||
|
|
|
@ -9,13 +9,15 @@ const PopupModal = ({
|
||||||
setIsModalOpen,
|
setIsModalOpen,
|
||||||
handleConfirm,
|
handleConfirm,
|
||||||
handleClose,
|
handleClose,
|
||||||
|
cancelButton = true,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
title?: string;
|
title?: string;
|
||||||
message?: string;
|
message?: string;
|
||||||
setIsModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
setIsModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
handleConfirm: () => void;
|
handleConfirm?: () => void;
|
||||||
handleClose?: () => void;
|
handleClose?: () => void;
|
||||||
|
cancelButton?: boolean;
|
||||||
children?: React.ReactElement;
|
children?: React.ReactElement;
|
||||||
}) => {
|
}) => {
|
||||||
const modalRoot = document.getElementById('modal-root');
|
const modalRoot = document.getElementById('modal-root');
|
||||||
|
@ -54,20 +56,24 @@ const PopupModal = ({
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
<div className='flex items-center justify-center p-6 gap-4'>
|
<div className='flex items-center justify-center p-6 gap-4'>
|
||||||
<button
|
{handleConfirm && (
|
||||||
type='button'
|
<button
|
||||||
className='btn btn-primary'
|
type='button'
|
||||||
onClick={handleConfirm}
|
className='btn btn-primary'
|
||||||
>
|
onClick={handleConfirm}
|
||||||
Confirm
|
>
|
||||||
</button>
|
Confirm
|
||||||
<button
|
</button>
|
||||||
type='button'
|
)}
|
||||||
className='btn btn-neutral'
|
{cancelButton && (
|
||||||
onClick={_handleClose}
|
<button
|
||||||
>
|
type='button'
|
||||||
Cancel
|
className='btn btn-neutral'
|
||||||
</button>
|
onClick={_handleClose}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue