From 4c3735812b1e88a33d99b6f8d040383190e5ccd6 Mon Sep 17 00:00:00 2001 From: Oleg Shilov Date: Wed, 28 Aug 2024 15:10:04 +0700 Subject: [PATCH] fix: select menu button render fixed (#27) --- src/app/[locale]/shariah/page.tsx | 3 +- src/components/pages/shariah-page.tsx | 6 -- src/components/ui/header-desktop.tsx | 14 +--- src/components/ui/modal.tsx | 64 +++++---------- src/components/ui/select.tsx | 109 +++++++++++--------------- tailwind.config.js | 5 ++ 6 files changed, 77 insertions(+), 124 deletions(-) diff --git a/src/app/[locale]/shariah/page.tsx b/src/app/[locale]/shariah/page.tsx index 7b166f9..9148ed5 100644 --- a/src/app/[locale]/shariah/page.tsx +++ b/src/app/[locale]/shariah/page.tsx @@ -21,10 +21,11 @@ export const metadata: Metadata = { }, }; export default async function Page({ - params: { locale }, + params, }: { params: { locale: SupportedLocales }; }) { + const { locale } = params; const [fatwa, members] = await Promise.all([ await getFatwaContentFromFalconer(locale), await getMembersContentFromFalconer(locale), diff --git a/src/components/pages/shariah-page.tsx b/src/components/pages/shariah-page.tsx index 9704341..1e03753 100644 --- a/src/components/pages/shariah-page.tsx +++ b/src/components/pages/shariah-page.tsx @@ -178,7 +178,6 @@ export function ShariahPage({ onSectionInView={handleSectionInView} initialInView > - {/*
*/}
@@ -186,14 +185,12 @@ export function ShariahPage({
@@ -202,7 +199,6 @@ export function ShariahPage({
@@ -226,7 +222,6 @@ export function ShariahPage({ @@ -245,7 +240,6 @@ export function ShariahPage({ diff --git a/src/components/ui/header-desktop.tsx b/src/components/ui/header-desktop.tsx index e5a7031..3f3af36 100644 --- a/src/components/ui/header-desktop.tsx +++ b/src/components/ui/header-desktop.tsx @@ -6,7 +6,6 @@ import { useEffect, useState, } from 'react'; -import { Transition } from '@headlessui/react'; import clsx from 'clsx'; import { useTranslations } from 'next-intl'; import { LocaleLink } from '@/navigation'; @@ -93,22 +92,13 @@ function HeaderDropdown({ - + {isDropdownOpen && (
{children}
-
+ )} ); } diff --git a/src/components/ui/modal.tsx b/src/components/ui/modal.tsx index e368487..cc4f429 100644 --- a/src/components/ui/modal.tsx +++ b/src/components/ui/modal.tsx @@ -1,11 +1,6 @@ 'use client'; -import { - Fragment, - PropsWithChildren, - SyntheticEvent, - useCallback, -} from 'react'; -import { Dialog, Transition } from '@headlessui/react'; +import { PropsWithChildren, SyntheticEvent, useCallback } from 'react'; +import { Dialog } from '@headlessui/react'; import clsx from 'clsx'; function ModalOverlay({ onClose }: { onClose: () => void }) { @@ -22,22 +17,12 @@ function ModalOverlay({ onClose }: { onClose: () => void }) { ); return ( - -
- +
); } @@ -90,28 +75,21 @@ export function Modal({ onClose: () => void; }>) { return ( - - - + + -
-
- -
- {children} -
-
+
+
+
+ {children}
-
-
+
+ ); } diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index 3e9c791..6dfc87c 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Fragment, useMemo } from 'react'; -import { Menu, Transition } from '@headlessui/react'; +import { useMemo } from 'react'; +import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react'; import clsx from 'clsx'; export function Select({ @@ -25,7 +25,7 @@ export function Select({ const optionsToRender = useMemo(() => { return variants.map(({ id, title }) => { return ( - )} - + ); }); }, [current, onChange, variants]); return ( - - {({ open }) => { - return ( - - ); - }} - - - - + {currentValue ? ( + {currentValue.title} + ) : ( + {placeholder} + )} +
+ + - {optionsToRender} - - + + + + + + {optionsToRender} + ); } diff --git a/tailwind.config.js b/tailwind.config.js index 3d799c7..aa576a3 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -36,10 +36,15 @@ const config = { from: { transform: 'translateX(0)' }, to: { transform: 'translateX(-100%)' }, }, + reveal: { + '0%': { opacity: 0 }, + '100%': { opacity: 1 }, + }, }, animation: { 'scroll-left': 'scroll-left 60s linear infinite', 'scroll-right': 'scroll-right 60s linear infinite', + reveal: 'reveal 0.15s', }, screens: {}, },