2022-02-09 23:27:54 +01:00
|
|
|
import Image from 'next/image'
|
2022-03-05 18:22:30 +01:00
|
|
|
import { useState } from 'react'
|
2022-03-16 11:25:44 +01:00
|
|
|
import useTranslation from 'next-translate/useTranslation'
|
|
|
|
import classNames from 'classnames'
|
2022-03-05 18:22:30 +01:00
|
|
|
|
|
|
|
import { Loader } from '../../design/Loader'
|
2022-02-09 23:27:54 +01:00
|
|
|
|
|
|
|
export interface ConfirmGuildJoinProps {
|
|
|
|
className?: string
|
2022-03-05 18:22:30 +01:00
|
|
|
handleYes: () => void | Promise<void>
|
|
|
|
handleNo: () => void | Promise<void>
|
2022-02-09 23:27:54 +01:00
|
|
|
}
|
|
|
|
|
2022-03-16 11:25:44 +01:00
|
|
|
export const ConfirmGuildJoin: React.FC<ConfirmGuildJoinProps> = ({
|
|
|
|
...props
|
|
|
|
}) => {
|
|
|
|
const { t } = useTranslation()
|
2022-03-05 18:22:30 +01:00
|
|
|
const [isLoading, setIsLoading] = useState(false)
|
|
|
|
|
|
|
|
const handleYesLoading = async (): Promise<void> => {
|
|
|
|
setIsLoading((isLoading) => !isLoading)
|
2022-03-16 11:25:44 +01:00
|
|
|
await props.handleYes()
|
2022-03-05 18:22:30 +01:00
|
|
|
}
|
2022-02-09 23:27:54 +01:00
|
|
|
|
|
|
|
return (
|
2022-03-16 11:25:44 +01:00
|
|
|
<div className={props.className}>
|
|
|
|
<Loader
|
|
|
|
className={classNames('absolute scale-0 transition', {
|
|
|
|
'scale-100': isLoading
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<div
|
|
|
|
className={classNames(
|
|
|
|
'visible flex flex-col items-center opacity-100 transition-all',
|
|
|
|
{
|
|
|
|
'invisible opacity-0': isLoading
|
|
|
|
}
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<Image
|
2022-04-07 16:54:05 +02:00
|
|
|
quality={100}
|
2022-03-16 11:25:44 +01:00
|
|
|
src='/images/svg/design/join-guild.svg'
|
|
|
|
alt='Join Guild Illustration'
|
|
|
|
height={150}
|
|
|
|
width={150}
|
|
|
|
/>
|
|
|
|
<div className='mt-8 flex flex-col'>
|
|
|
|
<h1 className='mb-6 text-center text-xl'>
|
|
|
|
{t('application:join-the-guild')} ?
|
|
|
|
</h1>
|
|
|
|
<div className='flex gap-7'>
|
|
|
|
<button
|
|
|
|
className='rounded-3xl bg-success px-8 py-2 text-white transition hover:brightness-125 dark:text-black hover:dark:brightness-75'
|
|
|
|
onClick={handleYesLoading}
|
|
|
|
>
|
|
|
|
{t('common:yes')}
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
className='rounded-3xl bg-error px-8 py-2 text-white transition hover:brightness-125 dark:text-black hover:dark:brightness-75'
|
|
|
|
onClick={props.handleNo}
|
|
|
|
>
|
|
|
|
{t('common:no')}
|
|
|
|
</button>
|
2022-03-05 18:22:30 +01:00
|
|
|
</div>
|
2022-03-16 11:25:44 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-02-09 23:27:54 +01:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|