feat: new public website
This commit is contained in:
28
apps/public/src/components/battery-icon.tsx
Normal file
28
apps/public/src/components/battery-icon.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
'use client';
|
||||
import {
|
||||
BatteryFullIcon,
|
||||
BatteryLowIcon,
|
||||
BatteryMediumIcon,
|
||||
type LucideProps,
|
||||
} from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export function BatteryIcon(props: LucideProps) {
|
||||
const [index, setIndex] = useState(0);
|
||||
const icons = [BatteryLowIcon, BatteryMediumIcon, BatteryFullIcon];
|
||||
|
||||
const Icon = icons[index];
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setIndex((index + 1) % icons.length);
|
||||
}, 750);
|
||||
return () => clearInterval(interval);
|
||||
}, [index]);
|
||||
|
||||
if (!Icon) {
|
||||
return <div className={props.className} />;
|
||||
}
|
||||
|
||||
return <Icon {...props} />;
|
||||
}
|
||||
Reference in New Issue
Block a user