Feat: Add DropdownButton prop type

This commit is contained in:
igorrCarvalho 2023-08-29 18:53:39 -03:00
commit da703d65e3
3 changed files with 9 additions and 2 deletions

View file

@ -1,12 +1,13 @@
import { useState } from "react"; import { useState } from "react";
import IconComponent from "../genericIconComponent"; import IconComponent from "../genericIconComponent";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { dropdownButtonPropsType } from "../../types/components";
export default function DropdownButton({ export default function DropdownButton({
firstButtonName, firstButtonName,
onFirstBtnClick, onFirstBtnClick,
options, options,
}): JSX.Element { }: dropdownButtonPropsType): JSX.Element {
const [showOptions, setShowOptions] = useState(false); const [showOptions, setShowOptions] = useState(false);
return ( return (

View file

@ -53,7 +53,7 @@ export default function HomePage(): JSX.Element {
navigate("/flow/" + id); navigate("/flow/" + id);
}); });
}} }}
options={[{name: "yesyes", onBtnClick: () => console.log('dips')}, {name: "dips", onBtnClick: () => console.log('yesyes')}]} options={[{name: "Import from JSON", onBtnClick: () => console.log('imported')}]}
/> />
</div> </div>
</div> </div>

View file

@ -544,3 +544,9 @@ export type fetchErrorComponentType = {
message: string; message: string;
description: string; description: string;
}; };
export type dropdownButtonPropsType = {
firstButtonName: string;
onFirstBtnClick: () => void;
options: Array<{ name: string; onBtnClick: () => void; }>;
};