Skip to content

Commit

Permalink
feat(shared): Tabs 컴포넌트 내부 배경 색상 추가 (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukvvon authored Nov 26, 2023
1 parent 0b74539 commit 0b240c2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/shared/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
TabPanel,
TabPanels,
Tabs as ChakraTabs,
useToken,
} from '@chakra-ui/react';
import { type ReactNode, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
Expand All @@ -20,20 +21,23 @@ export default function Tabs({ tabs }: TabsProps) {
const [searchParams, setSearchParams] = useSearchParams();
const tabId = Number(searchParams.get('tab'));
const [tabIndex, setTabIndex] = useState(tabId);
const [space3] = useToken('space', [3]);

const handleTabsChange = (index: number) => setTabIndex(index);

const handleSetTabParam = () => setSearchParams({ tab: `${tabIndex}` });

return (
<ChakraTabs
pt={3}
mt={3}
isFitted
variant="unstyled"
onChange={handleTabsChange}
index={tabIndex}
h={`calc(100% - ${space3})`}
bgColor="gray.50"
>
<TabList>
<TabList bgColor="white">
{tabs.map((tab, index) => (
<Tab
color="gray.400"
Expand Down

0 comments on commit 0b240c2

Please sign in to comment.