2025-12-12 10:52:32 +01:00
|
|
|
import { createContext, type ReactNode, useContext, useMemo } from 'react';
|
2025-07-04 14:45:33 +02:00
|
|
|
|
|
|
|
|
const LucideContext = createContext<{
|
|
|
|
|
size?: number;
|
|
|
|
|
color?: string;
|
|
|
|
|
strokeWidth?: number;
|
|
|
|
|
absoluteStrokeWidth?: boolean;
|
|
|
|
|
}>({
|
|
|
|
|
size: 24,
|
|
|
|
|
color: 'currentColor',
|
|
|
|
|
strokeWidth: 2,
|
|
|
|
|
absoluteStrokeWidth: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
interface LucideProviderProps {
|
|
|
|
|
children: ReactNode;
|
2025-10-16 17:57:23 +02:00
|
|
|
size?: number;
|
2025-07-04 14:45:33 +02:00
|
|
|
color?: string;
|
|
|
|
|
strokeWidth?: number;
|
|
|
|
|
absoluteStrokeWidth?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-12 10:52:32 +01:00
|
|
|
export function LucideProvider({
|
|
|
|
|
children,
|
|
|
|
|
size,
|
|
|
|
|
color,
|
|
|
|
|
strokeWidth,
|
|
|
|
|
absoluteStrokeWidth,
|
|
|
|
|
}: LucideProviderProps) {
|
|
|
|
|
const value = useMemo(
|
|
|
|
|
() => ({
|
|
|
|
|
size,
|
|
|
|
|
color,
|
|
|
|
|
strokeWidth,
|
|
|
|
|
absoluteStrokeWidth,
|
|
|
|
|
}),
|
|
|
|
|
[size, color, strokeWidth, absoluteStrokeWidth],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return <LucideContext.Provider value={value}>{children}</LucideContext.Provider>;
|
2025-07-04 14:45:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const useLucideContext = () => useContext(LucideContext);
|