Restructured app to work better with localized slugs

This commit is contained in:
Henrik Larsson
2023-08-12 13:55:30 +02:00
parent f14d0cb865
commit 60d1810707
21 changed files with 122 additions and 501 deletions

View File

@@ -5,7 +5,6 @@ import type { Product } from '@/lib/storm/product';
import Price from 'components/price';
import Text from 'components/ui/text';
import { cn } from 'lib/utils';
import { useLocale, useTranslations } from 'next-intl';
import Link from 'next/link';
import { FC } from 'react';
interface Props {
@@ -16,12 +15,11 @@ interface Props {
const ProductCard: FC<Props> = ({ product, className, variant = 'default' }) => {
const rootClassName = cn('w-full group relative overflow-hidden', className);
const t = useTranslations('routes');
const locale = useLocale();
console.log(product);
return (
<Link
href={`/${locale}/${t('product')}/${product.slug}`}
href={`${product.slug}`}
className={rootClassName}
aria-label={product.name}
locale={product.locale}