You are given a task to integrate an existing React component in the codebase
The codebase should support:
- shadcn project structure
- Tailwind CSS
- Typescript
If it doesn't, provide instructions on how to setup project via shadcn CLI, install Tailwind or Typescript.
Determine the default path for components and styles.
If default path for components is not /components/ui, provide instructions on why it's important to create this folder
Copy-paste this component to /components/ui folder:
```tsx
component.tsx
'use client';
import { cn } from '@/lib/utils';
import { motion, Transition } from 'motion/react';
export type GlowEffectProps = {
className?: string;
style?: React.CSSProperties;
colors?: string[];
mode?:
| 'rotate'
| 'pulse'
| 'breathe'
| 'colorShift'
| 'flowHorizontal'
| 'static';
blur?:
| number
| 'softest'
| 'soft'
| 'medium'
| 'strong'
| 'stronger'
| 'strongest'
| 'none';
transition?: Transition;
scale?: number;
duration?: number;
};
export function GlowEffect({
className,
style,
colors = ['#FF5733', '#33FF57', '#3357FF', '#F1C40F'],
mode = 'rotate',
blur = 'medium',
transition,
scale = 1,
duration = 5,
}: GlowEffectProps) {
const BASE_TRANSITION = {
repeat: Infinity,
duration: duration,
ease: 'linear',
};
const animations = {
rotate: {
background: [
`conic-gradient(from 0deg at 50% 50%, ${colors.join(', ')})`,
`conic-gradient(from 360deg at 50% 50%, ${colors.join(', ')})`,
],
transition: {
...(transition ?? BASE_TRANSITION),
},
},
pulse: {
background: colors.map(
(color) =>
`radial-gradient(circle at 50% 50%, ${color} 0%, transparent 100%)`
),
scale: [1 * scale, 1.1 * scale, 1 * scale],
opacity: [0.5, 0.8, 0.5],
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
breathe: {
background: [
...colors.map(
(color) =>
`radial-gradient(circle at 50% 50%, ${color} 0%, transparent 100%)`
),
],
scale: [1 * scale, 1.05 * scale, 1 * scale],
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
colorShift: {
background: colors.map((color, index) => {
const nextColor = colors[(index + 1) % colors.length];
return `conic-gradient(from 0deg at 50% 50%, ${color} 0%, ${nextColor} 50%, ${color} 100%)`;
}),
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
flowHorizontal: {
background: colors.map((color) => {
const nextColor = colors[(colors.indexOf(color) + 1) % colors.length];
return `linear-gradient(to right, ${color}, ${nextColor})`;
}),
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
static: {
background: `linear-gradient(to right, ${colors.join(', ')})`,
},
};
const getBlurClass = (blur: GlowEffectProps['blur']) => {
if (typeof blur === 'number') {
return `blur-[${blur}px]`;
}
const presets = {
softest: 'blur-sm',
soft: 'blur',
medium: 'blur-md',
strong: 'blur-lg',
stronger: 'blur-xl',
strongest: 'blur-xl',
none: 'blur-none',
};
return presets[blur as keyof typeof presets];
};
return (