Skip to content

Commit

Permalink
added tab scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed Aug 19, 2024
1 parent 0e38437 commit e1c1e48
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 71 deletions.
3 changes: 3 additions & 0 deletions src/blocks/tabs/Tabs.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const StyledFillTabs = styled(ReachTabs)`
`;

export const StyledFillTabList = styled(TabList)`
overflow: scroll hidden;
display: flex;
width: fit-content;
padding: var(--spacing-xxxs);
Expand Down Expand Up @@ -68,6 +69,7 @@ export const StyledLineTabs = styled(ReachTabs)`
`;

export const StyledLineTabList = styled(TabList)`
overflow: scroll hidden;
display: flex;
background-color: var(--surface-transparent);
gap: var(--spacing-xs);
Expand Down Expand Up @@ -119,6 +121,7 @@ export const StyledLineTab = styled(Tab)`
`;

export const StyledTabLabel = styled.span`
white-space: nowrap;
font-family: var(--font-family);
font-size: ${textVariants['h5-semibold'].fontSize};
font-style: ${textVariants['h5-semibold'].fontStyle};
Expand Down
61 changes: 0 additions & 61 deletions src/modules/rewards/components/RewardsTabs.tsx

This file was deleted.

33 changes: 23 additions & 10 deletions src/modules/rewards/components/RewardsTabsContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import { FC } from 'react';

//Components
import { Box } from 'blocks';
import { RewardsTabs } from './RewardsTabs';
import { Box, TabItem, Tabs } from 'blocks';
import { DashboardSection } from './DashboardSection';
import { LeaderBoardSection } from './LeaderBoardSection';
import { RewardsActivitiesSection } from './RewardsActivitiesSection';
import { RewardsTabs as RewardsTabsType } from '../Rewards.types';
import { RewardsTabs, RewardsTabs as RewardsTabsType } from '../Rewards.types';

export type RewardsTabsContainerProps = {
activeTab: RewardsTabsType;
handleSetActiveTab: (tab: RewardsTabsType) => void;
};

const RewardsTabsContainer: FC<RewardsTabsContainerProps> = ({ activeTab, handleSetActiveTab }) => {
const rewardsTabs: TabItem[] = [
{
key: 'dashboard',
label: 'Dashboard',
children: <DashboardSection onGetStarted={() => handleSetActiveTab('activity')} />,
},
{
key: 'activity',
label: 'Reward Activities',
children: <RewardsActivitiesSection />,
},
{
key: 'leaderboard',
label: 'Leaderboard',
children: <LeaderBoardSection />,
},
];
return (
<Box
backgroundColor="surface-primary"
Expand All @@ -27,14 +43,11 @@ const RewardsTabsContainer: FC<RewardsTabsContainerProps> = ({ activeTab, handle
display="flex"
flexDirection="column"
>
<RewardsTabs
activeTab={activeTab}
handleSetActiveTab={handleSetActiveTab}
<Tabs
items={rewardsTabs}
activeKey={activeTab}
onChange={(activeKey) => handleSetActiveTab(activeKey as RewardsTabs)}
/>

{activeTab === 'dashboard' && <DashboardSection onGetStarted={() => handleSetActiveTab('activity')} />}
{activeTab === 'activity' && <RewardsActivitiesSection />}
{activeTab === 'leaderboard' && <LeaderBoardSection />}
</Box>
</Box>
);
Expand Down

0 comments on commit e1c1e48

Please sign in to comment.