Template
Initial commit: Shopify storefront Next.js template
Next.js 16 + React 19 storefront template with Shopify Storefront API integration, Tailwind v4, and shadcn/ui components. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0111qSr3KopyGRsJ6LznR1xZ
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import * as RemixIcons from '@remixicon/react';
|
||||
|
||||
interface RemixIconProps {
|
||||
name: string; // e.g. "RiTruckLine"
|
||||
className?: string;
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const RemixIcon: React.FC<RemixIconProps> = ({
|
||||
name,
|
||||
className,
|
||||
size = 16,
|
||||
}) => {
|
||||
if (!name) return null;
|
||||
|
||||
// Normalise: accept "RiTruckLine", "ri-truck-line", or "riTruckLine"
|
||||
const normalised = name
|
||||
// ri-truck-line → RiTruckLine
|
||||
.replace(/^ri-/, 'Ri')
|
||||
.replace(/-([a-z])/g, (_, c) => c.toUpperCase())
|
||||
// ensure first char is uppercase
|
||||
.replace(/^./, (c) => c.toUpperCase());
|
||||
|
||||
const IconComponent = (
|
||||
RemixIcons as Record<
|
||||
string,
|
||||
React.FC<{ className?: string; size?: number }>
|
||||
>
|
||||
)[normalised];
|
||||
|
||||
if (!IconComponent) {
|
||||
console.warn(
|
||||
`[RemixIcon] Icon "${name}" (resolved: "${normalised}") not found.`
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return <IconComponent className={className} size={size} />;
|
||||
};
|
||||
|
||||
export default RemixIcon;
|
||||
Reference in New Issue
Block a user