mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-13 00:26:42 +03:00
add dots variant to step indicator
This commit is contained in:
parent
1bb35380e6
commit
ef3e9bccd3
@ -4,15 +4,39 @@ import { useTranslation } from "react-i18next";
|
|||||||
type StepIndicatorProps = {
|
type StepIndicatorProps = {
|
||||||
steps: string[];
|
steps: string[];
|
||||||
currentStep: number;
|
currentStep: number;
|
||||||
translationNameSpace: string;
|
variant?: "default" | "dots";
|
||||||
|
translationNameSpace?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function StepIndicator({
|
export default function StepIndicator({
|
||||||
steps,
|
steps,
|
||||||
currentStep,
|
currentStep,
|
||||||
|
variant = "default",
|
||||||
translationNameSpace,
|
translationNameSpace,
|
||||||
}: StepIndicatorProps) {
|
}: StepIndicatorProps) {
|
||||||
const { t } = useTranslation(translationNameSpace);
|
const { t } = useTranslation(translationNameSpace);
|
||||||
|
|
||||||
|
if (variant == "dots") {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-row justify-center gap-2">
|
||||||
|
{steps.map((_, idx) => (
|
||||||
|
<div
|
||||||
|
key={idx}
|
||||||
|
className={cn(
|
||||||
|
"size-2 rounded-full transition-colors",
|
||||||
|
currentStep === idx
|
||||||
|
? "bg-selected"
|
||||||
|
: currentStep > idx
|
||||||
|
? "bg-muted-foreground"
|
||||||
|
: "bg-muted",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default variant (original behavior)
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row justify-evenly">
|
<div className="flex flex-row justify-evenly">
|
||||||
{steps.map((name, idx) => (
|
{steps.map((name, idx) => (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user