Dwinzo_dev/app/src/components/ui/inputs/ToggleHeader.tsx

32 lines
829 B
TypeScript
Raw Normal View History

2025-03-25 06:17:41 +00:00
import React from "react";
interface ToggleHeaderProps {
options: string[]; // Array of strings representing the options
activeOption: string; // The currently active option
handleClick: (option: string) => void; // Function to handle click events
}
const ToggleHeader: React.FC<ToggleHeaderProps> = ({
options,
activeOption,
handleClick,
}) => {
return (
<div className="toggle-header-container">
{options.map((option, index) => (
<div
key={index}
className={`toggle-header-item ${
option === activeOption ? "active" : ""
}`}
onClick={() => handleClick(option)} // Call handleClick when an option is clicked
>
{option}
</div>
))}
</div>
);
};
export default ToggleHeader;