34 lines
751 B
TypeScript
34 lines
751 B
TypeScript
'use client';
|
|
|
|
import { ChevronLeft } from 'lucide-react';
|
|
import { useTranslations } from 'next-intl';
|
|
|
|
/** Hide from this breakpoint up (Cases = lg, Treatment = xl). */
|
|
type HideFrom = 'lg' | 'xl';
|
|
|
|
const HIDE_FROM_CLASS: Record<HideFrom, string> = {
|
|
lg: 'lg:hidden',
|
|
xl: 'xl:hidden',
|
|
};
|
|
|
|
export function MobileDetailBackButton({
|
|
onClick,
|
|
hideFrom = 'lg',
|
|
}: {
|
|
onClick: () => void;
|
|
hideFrom?: HideFrom;
|
|
}) {
|
|
const t = useTranslations('common');
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={onClick}
|
|
className={`${HIDE_FROM_CLASS[hideFrom]} mb-1.5 inline-flex items-center gap-1 text-sm text-primary hover:opacity-90`}
|
|
>
|
|
<ChevronLeft className="h-4 w-4 icon-flat" />
|
|
{t('back')}
|
|
</button>
|
|
);
|
|
}
|