Merge branch 'feature/slicing'
# Conflicts: # app/contexts/news.tsx # app/routes/_layout.admin.dashboard._index.tsx
This commit is contained in:
commit
47af75ebd3
@ -7,6 +7,7 @@ import {
|
|||||||
} from '@headlessui/react'
|
} from '@headlessui/react'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
|
import { LeftArrow } from '~/components/icons/left-arrow'
|
||||||
import { APP } from '~/data/meta'
|
import { APP } from '~/data/meta'
|
||||||
|
|
||||||
type ModalProperties = {
|
type ModalProperties = {
|
||||||
@ -34,8 +35,17 @@ export const PopupModal = ({
|
|||||||
className="fixed inset-0 bg-black/50 duration-300 ease-out data-[closed]:opacity-0"
|
className="fixed inset-0 bg-black/50 duration-300 ease-out data-[closed]:opacity-0"
|
||||||
transition
|
transition
|
||||||
/>
|
/>
|
||||||
<div className="fixed inset-0 flex w-screen items-center justify-center p-4">
|
<div className="fixed inset-0 flex w-screen justify-center overflow-y-auto p-4 max-sm:bg-white sm:items-center">
|
||||||
<DialogPanel className="max-w-lg space-y-6 rounded-lg bg-white p-8 shadow-lg duration-300 ease-out data-[closed]:scale-95 data-[closed]:opacity-0">
|
<DialogPanel className="max-w-lg space-y-6 rounded-lg bg-white p-8 duration-300 ease-out data-[closed]:scale-95 data-[closed]:opacity-0 sm:shadow-lg">
|
||||||
|
<button
|
||||||
|
onClick={onClose}
|
||||||
|
className="top-4 left-4 items-center lg:hidden"
|
||||||
|
>
|
||||||
|
<LeftArrow
|
||||||
|
width={50}
|
||||||
|
height={50}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
<DialogTitle className="flex justify-center">
|
<DialogTitle className="flex justify-center">
|
||||||
<img
|
<img
|
||||||
src={APP.logo}
|
src={APP.logo}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export default function Banner() {
|
|||||||
className="mt-2 h-full py-2"
|
className="mt-2 h-full py-2"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={'/public/images/banner.png'}
|
src={'/images/banner.png'}
|
||||||
alt={APP.title}
|
alt={APP.title}
|
||||||
className="h-[70px] w-[100%] sm:h-full"
|
className="h-[70px] w-[100%] sm:h-full"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
// import { EyeIcon, EyeOffIcon } from 'lucide-react'
|
// import { EyeIcon, EyeOffIcon } from 'lucide-react'
|
||||||
import { useState, type Dispatch, type SetStateAction } from 'react'
|
import { useState, type Dispatch, type SetStateAction } from 'react'
|
||||||
import { Link } from 'react-router'
|
|
||||||
|
|
||||||
import { EyeIcon } from '~/components/icons/eye'
|
import { EyeIcon } from '~/components/icons/eye'
|
||||||
|
|
||||||
@ -9,10 +8,11 @@ import { Button } from './button'
|
|||||||
type TProperties = {
|
type TProperties = {
|
||||||
setIsRegisterOpen: Dispatch<SetStateAction<boolean>>
|
setIsRegisterOpen: Dispatch<SetStateAction<boolean>>
|
||||||
setIsLoginOpen: Dispatch<SetStateAction<boolean>>
|
setIsLoginOpen: Dispatch<SetStateAction<boolean>>
|
||||||
|
setIsForgetOpen: Dispatch<SetStateAction<boolean>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FormLogin = (properties: TProperties) => {
|
export const FormLogin = (properties: TProperties) => {
|
||||||
const { setIsRegisterOpen, setIsLoginOpen } = properties
|
const { setIsRegisterOpen, setIsLoginOpen, setIsForgetOpen } = properties
|
||||||
const [showPassword, setShowPassword] = useState(false)
|
const [showPassword, setShowPassword] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -67,14 +67,18 @@ export const FormLogin = (properties: TProperties) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Lupa Kata Sandi */}
|
{/* Lupa Kata Sandi */}
|
||||||
<div className="mb-4 flex justify-between">
|
<div className="mb-4 flex items-center justify-between text-sm">
|
||||||
<span className="text-gray-600">Lupa Kata Sandi?</span>
|
<span className="text-gray-600">Lupa Kata Sandi?</span>
|
||||||
<Link
|
<Button
|
||||||
to="/reset-password"
|
onClick={() => {
|
||||||
|
setIsLoginOpen(false)
|
||||||
|
setIsForgetOpen(true)
|
||||||
|
}}
|
||||||
className="font-semibold text-[#2E2F7C]"
|
className="font-semibold text-[#2E2F7C]"
|
||||||
|
variant="link"
|
||||||
>
|
>
|
||||||
Reset Kata Sandi
|
Reset Kata Sandi
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tombol Masuk */}
|
{/* Tombol Masuk */}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ type NewsContextProperties = {
|
|||||||
setIsLoginOpen: Dispatch<SetStateAction<boolean>>
|
setIsLoginOpen: Dispatch<SetStateAction<boolean>>
|
||||||
isRegisterOpen: boolean
|
isRegisterOpen: boolean
|
||||||
setIsRegisterOpen: Dispatch<SetStateAction<boolean>>
|
setIsRegisterOpen: Dispatch<SetStateAction<boolean>>
|
||||||
|
isForgetOpen: boolean
|
||||||
|
setForgetOpen: Dispatch<SetStateAction<boolean>>
|
||||||
}
|
}
|
||||||
|
|
||||||
const NewsContext = createContext<NewsContextProperties | undefined>(undefined)
|
const NewsContext = createContext<NewsContextProperties | undefined>(undefined)
|
||||||
@ -19,10 +21,18 @@ const NewsContext = createContext<NewsContextProperties | undefined>(undefined)
|
|||||||
export const NewsProvider = ({ children }: PropsWithChildren) => {
|
export const NewsProvider = ({ children }: PropsWithChildren) => {
|
||||||
const [isLoginOpen, setIsLoginOpen] = useState(false)
|
const [isLoginOpen, setIsLoginOpen] = useState(false)
|
||||||
const [isRegisterOpen, setIsRegisterOpen] = useState(false)
|
const [isRegisterOpen, setIsRegisterOpen] = useState(false)
|
||||||
|
const [isForgetOpen, setForgetOpen] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NewsContext.Provider
|
<NewsContext.Provider
|
||||||
value={{ isLoginOpen, setIsLoginOpen, isRegisterOpen, setIsRegisterOpen }}
|
value={{
|
||||||
|
isLoginOpen,
|
||||||
|
setIsLoginOpen,
|
||||||
|
isRegisterOpen,
|
||||||
|
setIsRegisterOpen,
|
||||||
|
isForgetOpen,
|
||||||
|
setForgetOpen,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</NewsContext.Provider>
|
</NewsContext.Provider>
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { type PropsWithChildren } from 'react'
|
|||||||
|
|
||||||
import { PopupModal } from '~/components/popup/modal'
|
import { PopupModal } from '~/components/popup/modal'
|
||||||
import Banner from '~/components/ui/banner'
|
import Banner from '~/components/ui/banner'
|
||||||
|
import FormForgotPassword from '~/components/ui/form-forgot-password'
|
||||||
import { FormLogin } from '~/components/ui/form-login'
|
import { FormLogin } from '~/components/ui/form-login'
|
||||||
import { FormRegister } from '~/components/ui/form-register'
|
import { FormRegister } from '~/components/ui/form-register'
|
||||||
import { useNewsContext } from '~/contexts/news'
|
import { useNewsContext } from '~/contexts/news'
|
||||||
@ -13,8 +14,14 @@ import { HeaderTop } from './header-top'
|
|||||||
|
|
||||||
export const NewsDefaultLayout = (properties: PropsWithChildren) => {
|
export const NewsDefaultLayout = (properties: PropsWithChildren) => {
|
||||||
const { children } = properties
|
const { children } = properties
|
||||||
const { isLoginOpen, setIsLoginOpen, isRegisterOpen, setIsRegisterOpen } =
|
const {
|
||||||
useNewsContext()
|
isLoginOpen,
|
||||||
|
setIsLoginOpen,
|
||||||
|
isRegisterOpen,
|
||||||
|
setIsRegisterOpen,
|
||||||
|
isForgetOpen,
|
||||||
|
setForgetOpen,
|
||||||
|
} = useNewsContext()
|
||||||
return (
|
return (
|
||||||
<main className="relative min-h-dvh bg-[#ECECEC]">
|
<main className="relative min-h-dvh bg-[#ECECEC]">
|
||||||
<header>
|
<header>
|
||||||
@ -39,16 +46,25 @@ export const NewsDefaultLayout = (properties: PropsWithChildren) => {
|
|||||||
<FormLogin
|
<FormLogin
|
||||||
setIsRegisterOpen={setIsRegisterOpen}
|
setIsRegisterOpen={setIsRegisterOpen}
|
||||||
setIsLoginOpen={setIsLoginOpen}
|
setIsLoginOpen={setIsLoginOpen}
|
||||||
|
setIsForgetOpen={setForgetOpen}
|
||||||
/>
|
/>
|
||||||
</PopupModal>
|
</PopupModal>
|
||||||
|
|
||||||
<PopupModal
|
<PopupModal
|
||||||
isOpen={isRegisterOpen}
|
isOpen={isRegisterOpen}
|
||||||
onClose={() => setIsRegisterOpen(false)}
|
onClose={() => setIsRegisterOpen(false)}
|
||||||
description="Selamat Datang, silakan daftarkan akun Anda untuk melanjutkan!"
|
description="Selamat Datang, silakan isi keterangan akun Anda untuk melanjutkan!"
|
||||||
>
|
>
|
||||||
<FormRegister />
|
<FormRegister />
|
||||||
</PopupModal>
|
</PopupModal>
|
||||||
|
|
||||||
|
<PopupModal
|
||||||
|
isOpen={isForgetOpen}
|
||||||
|
onClose={() => setForgetOpen(false)}
|
||||||
|
description="Selamat Datang, silakan isi keterangan akun Anda untuk melanjutkan!"
|
||||||
|
>
|
||||||
|
<FormForgotPassword />
|
||||||
|
</PopupModal>
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user