import cx from "classnames"; import React from "react"; export const showTitlesFromOptions = ["md", "lg", "xl"] as const; export const variantOptions = ["default", "inverse"] as const; export type ShowTitlesFrom = (typeof showTitlesFromOptions)[number]; export interface StepbarStep { href?: string; isCurrent?: boolean; title: React.ReactNode; } export interface StepbarProps extends React.HTMLAttributes { /** Arial label of nav element */ label?: string; /** Titles of non-current steps are visible from this breakpoint */ showTitlesFrom?: ShowTitlesFrom; /** Array of step objects */ steps: StepbarStep[]; } const CLASS_ROOT = "stepbar"; const Stepbar: React.FC = ({ showTitlesFrom, steps, label = "krok", className, ...other }) => { const currentItemIndex = steps.findIndex((step) => { return step.isCurrent; }); const GetStepContent = ( step: StepbarStep, index: number, ): React.ReactElement => { const fullTitle = `${index + 1}. ${step.title}`; return index < currentItemIndex ? ( {fullTitle} ) : ( {fullTitle} ); }; return ( ); }; Stepbar.displayName = "Stepbar"; export { Stepbar };