Skip to content

Commit

Permalink
⬆️ Bump to v1.5.3 <> Update in tab-menu option state
Browse files Browse the repository at this point in the history
  • Loading branch information
yashsehgal committed Jan 20, 2024
1 parent 27e1648 commit b8918e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "craftbook",
"private": false,
"version": "1.5.2",
"version": "1.5.3",
"author": "Yash Sehgal <[email protected]>",
"type": "module",
"files": [
Expand Down
11 changes: 10 additions & 1 deletion src/components/tab-menu/tab-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface TabMenuProps extends React.HTMLAttributes<HTMLDivElement> {
options: string[];
currentOption: string;
stretch?: boolean;
updateSelection: (option: string) => void;
}

interface TabMenuOptionProps
Expand All @@ -17,7 +18,14 @@ interface TabMenuOptionProps

const TabMenu = forwardRef<HTMLDivElement, TabMenuProps>(
(
{ className, options, currentOption = '', stretch = false, ...props },
{
className,
options,
currentOption = '',
stretch = false,
updateSelection,
...props
},
ref,
) => {
const [selectedOption, setSelectedOption] = useState<string>(
Expand Down Expand Up @@ -45,6 +53,7 @@ const TabMenu = forwardRef<HTMLDivElement, TabMenuProps>(
key={index}
onClick={() => {
setSelectedOption(option);
updateSelection(option);
}}
isSelected={option === selectedOption}
/>
Expand Down

0 comments on commit b8918e0

Please sign in to comment.