Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sulaiman-fern committed Aug 1, 2024
1 parent f0959e2 commit be1a269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/ui/app/src/mdx/components/tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ export const TabGroup: FC<TabGroupProps> = ({ tabs, groupId, toc: parentToc = tr
useEffect(() => {
if (anchor != null) {
const anchorTab = tabs.findIndex((tab) => slug(tab.title) === anchor);

if (anchorTab >= 0) {
setSelected(anchorTab.toString());
}
}
}, [anchor, tabs]);
}, [anchor, tabs, setSelected]);

return (
<RadixTabs.Root value={selected} onValueChange={setSelected}>
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/app/src/mdx/hooks/useTabSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { useAtom } from "jotai";
import { useEffect, useState } from "react";
import { FERN_GROUPS, Group, useGroup } from "../../atoms";

export const useTabSelection = ({ groupId }: { groupId?: string }) => {
export const useTabSelection: = ({
groupId,
}: {
groupId?: string;
}): { selected: string; setSelected: (val: string) => void } => {
const { selectedGroup } = useGroup({ key: groupId });
const [_, setGroups] = useAtom<Group>(FERN_GROUPS);
const [selectedTabIndex, setSelectedTabIndex] = useState("0");
Expand Down

0 comments on commit be1a269

Please sign in to comment.