🐛 fix(locale): Document

This commit is contained in:
web@ppanel 2024-11-17 13:31:05 +07:00
parent 0a8109bbc4
commit 6f0fa20737
4 changed files with 11 additions and 7 deletions

View File

@ -9,9 +9,11 @@ import { useOutsideClick } from '@shadcn/ui/hooks/use-outside-click';
import { cn } from '@shadcn/ui/lib/utils'; import { cn } from '@shadcn/ui/lib/utils';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { AnimatePresence, motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
import { useTranslations } from 'next-intl';
import { useEffect, useId, useRef, useState } from 'react'; import { useEffect, useId, useRef, useState } from 'react';
export function DocumentButton({ items }: { items: API.DocumentItem[] }) { export function DocumentButton({ items }: { items: API.DocumentItem[] }) {
const t = useTranslations('document');
const [active, setActive] = useState<API.DocumentItem | boolean | null>(null); const [active, setActive] = useState<API.DocumentItem | boolean | null>(null);
const id = useId(); const id = useId();
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
@ -126,7 +128,7 @@ export function DocumentButton({ items }: { items: API.DocumentItem[] }) {
'rounded-full', 'rounded-full',
)} )}
> >
{t('read')}
</motion.button> </motion.button>
</motion.div> </motion.div>
))} ))}

View File

@ -8,6 +8,7 @@ import { useOutsideClick } from '@shadcn/ui/hooks/use-outside-click';
import { cn } from '@shadcn/ui/lib/utils'; import { cn } from '@shadcn/ui/lib/utils';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { AnimatePresence, motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
import { useTranslations } from 'next-intl';
import { useEffect, useId, useRef, useState } from 'react'; import { useEffect, useId, useRef, useState } from 'react';
interface Item { interface Item {
@ -15,6 +16,8 @@ interface Item {
title: string; title: string;
} }
export function TutorialButton({ items }: { items: Item[] }) { export function TutorialButton({ items }: { items: Item[] }) {
const t = useTranslations('document');
const [active, setActive] = useState<Item | boolean | null>(null); const [active, setActive] = useState<Item | boolean | null>(null);
const id = useId(); const id = useId();
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
@ -143,7 +146,7 @@ export function TutorialButton({ items }: { items: Item[] }) {
'rounded-full', 'rounded-full',
)} )}
> >
{t('read')}
</motion.button> </motion.button>
</motion.div> </motion.div>
))} ))}

View File

@ -1,8 +1,6 @@
{ {
"back": "Back", "all": "All",
"category": "Category", "document": "Document",
"read": "Read", "read": "Read",
"tags": "Tags", "tutorial": "Tutorial"
"title": "Title",
"updatedAt": "Updated At"
} }

View File

@ -1,5 +1,6 @@
{ {
"all": "全部", "all": "全部",
"document": "文档", "document": "文档",
"read": "阅读",
"tutorial": "教程" "tutorial": "教程"
} }