Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal scroll in tab for mobile view #1812

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

37 changes: 25 additions & 12 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 } from '../Rewards.types';

export type RewardsTabsContainerProps = {
activeTab: RewardsTabsType;
handleSetActiveTab: (tab: RewardsTabsType) => void;
activeTab: RewardsTabs;
handleSetActiveTab: (tab: RewardsTabs) => 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
Loading