Skip to content

Commit

Permalink
rename copypasta
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnusrm committed Oct 2, 2023
1 parent 6d85402 commit 1f02ebe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/react/src/components/Tabs/TabItem/useTabItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ type UseTabItem = (props: TabItemProps) => {
/** Handles props for `ToggleGroup.Item` in context with `ToggleGroup` and `RovingTabIndex` */
export const useTabItem: UseTabItem = (props: TabItemProps) => {
const { ...rest } = props;
const toggleGroup = useContext(TabsContext);
const tabs = useContext(TabsContext);
const itemValue =
props.value ?? (typeof props.children === 'string' ? props.children : '');
const active = toggleGroup.value == itemValue;
const active = tabs.value == itemValue;
const buttonId = `togglegroup-item-${useId()}`;

return {
...rest,
active: active,
size: toggleGroup?.size,
size: tabs?.size,
buttonProps: {
id: buttonId,
'aria-checked': active,
'aria-current': active,
role: 'radio',
onClick: () => {
toggleGroup.onChange?.(itemValue);
tabs.onChange?.(itemValue);
},
},
};
Expand Down

0 comments on commit 1f02ebe

Please sign in to comment.