Skip to content

Commit

Permalink
feat: made the tabs not controlled
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuEScioN committed Jan 16, 2025
1 parent 4a18453 commit 77e5b13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions src/app/token/[tokenId]/Tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getIsSBTC } from '@/app/tokens/utils';
import { useState } from 'react';

import { ContractAvailableFunctions } from '../../../../common/components/ContractAvailableFunctions';
import { TabsContainer } from '../../../../common/components/TabsContainer';
Expand All @@ -24,11 +23,8 @@ export function TokenTabsBase({ tokenId, tokenInfo, developerData }: TokenTabsPr
const { data: contract } = useSuspenseContractById(tokenId);
const source = contract?.source_code;
const isSBTC = getIsSBTC(tokenId);
const [tabId, setTabId] = useState('confirmed');
return (
<TabsContainer
tabId={tabId}
setTabId={setTabId}
tabs={[
{
title: 'Confirmed',
Expand Down
12 changes: 2 additions & 10 deletions src/common/components/TabsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@ import { Section } from './Section';

export const TabsContainer: FC<
{
setTabId: (id: string) => void;
tabId: string;
title?: string | ReactNode;
tabs: TxListTab[];
actions?: ReactNode;
} & FlexProps
> = ({ setTabId, tabId, title, tabs, actions, ...props }) => {
> = ({ title, tabs, actions, ...props }) => {
return (
<Section title={title} {...props}>
<Tabs.Root
lazyMount
onValueChange={({ value: id }) => {
setTabId?.(id);
}}
value={tabId}
>
<Tabs.Root lazyMount defaultValue={tabs[0].id}>
<Tabs.List width="full" border={'none'} pb={1}>
<Flex
gap={4}
Expand Down

0 comments on commit 77e5b13

Please sign in to comment.