feat: use existing translation on all pages

This commit is contained in:
Sonny
2024-05-17 19:36:53 +02:00
committed by Sonny
parent 8077f8f9c9
commit 8176817030
19 changed files with 197 additions and 104 deletions

View File

@@ -1,5 +1,6 @@
import type Collection from '#models/collection';
import { route } from '@izzyjs/route/client';
import { useTranslation } from 'react-i18next';
import { BsThreeDotsVertical } from 'react-icons/bs';
import { GoPencil } from 'react-icons/go';
import { IoIosAddCircleOutline } from 'react-icons/io';
@@ -8,30 +9,34 @@ import Dropdown from '~/components/common/dropdown/dropdown';
import { DropdownItemLink } from '~/components/common/dropdown/dropdown_item';
import { appendCollectionId } from '~/lib/navigation';
const CollectionControls = ({
export default function CollectionControls({
collectionId,
}: {
collectionId: Collection['id'];
}) => (
<Dropdown label={<BsThreeDotsVertical />} svgSize={18}>
<DropdownItemLink href={route('link.create-form').url}>
<IoIosAddCircleOutline /> Add
</DropdownItemLink>
<DropdownItemLink
href={appendCollectionId(route('collection.edit-form').url, collectionId)}
>
<GoPencil /> Edit
</DropdownItemLink>
<DropdownItemLink
href={appendCollectionId(
route('collection.delete-form').url,
collectionId
)}
danger
>
<IoTrashOutline /> Delete
</DropdownItemLink>
</Dropdown>
);
export default CollectionControls;
}) {
const { t } = useTranslation('common');
return (
<Dropdown label={<BsThreeDotsVertical />} svgSize={18}>
<DropdownItemLink href={route('link.create-form').url}>
<IoIosAddCircleOutline /> {t('link.create')}
</DropdownItemLink>
<DropdownItemLink
href={appendCollectionId(
route('collection.edit-form').url,
collectionId
)}
>
<GoPencil /> {t('collection.edit')}
</DropdownItemLink>
<DropdownItemLink
href={appendCollectionId(
route('collection.delete-form').url,
collectionId
)}
danger
>
<IoTrashOutline /> {t('collection.delete')}
</DropdownItemLink>
</Dropdown>
);
}