mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Restructured app to work better with localized slugs
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import SanityImage from 'components/ui/sanity-image';
|
||||
import { cn } from 'lib/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import Link from 'next/link';
|
||||
import { FC } from 'react';
|
||||
interface Props {
|
||||
@@ -15,14 +12,9 @@ const CategoryCard: FC<Props> = ({ category, className }) => {
|
||||
'w-1/2 min-w-0 grow-0 shrink-0 group relative box-border overflow-hidden transition-transform ease-linear cursor-pointer basis-[50%]',
|
||||
className
|
||||
);
|
||||
const t = useTranslations('routes');
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={`/${t('category')}/${category.slug}`}
|
||||
className={rootClassName}
|
||||
aria-label={category.name}
|
||||
>
|
||||
<Link href={`${category.slug}`} className={rootClassName} aria-label={category.name}>
|
||||
<div className={'flex h-full w-full flex-1 flex-col justify-center'}>
|
||||
<div className="relative aspect-[3/4] h-full w-full">
|
||||
<SanityImage
|
||||
|
@@ -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}
|
||||
|
Reference in New Issue
Block a user