Skip to content

Commit

Permalink
fix: conditionally rendered Tablist only if there are multiple accoun…
Browse files Browse the repository at this point in the history
…ts. (#6274)

issue - 6267

---------

Co-authored-by: Charles Bochet <[email protected]>
  • Loading branch information
adithej and charlesBochet authored Jul 16, 2024
1 parent 3566e0b commit a8dfff3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const StyledDetailsContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(6)};
padding-top: ${({ theme }) => theme.spacing(6)};
`;

type SettingsAccountsCalendarChannelDetailsProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import styled from '@emotion/styled';
import { useRecoilValue } from 'recoil';

import { CalendarChannel } from '@/accounts/types/CalendarChannel';
Expand All @@ -13,6 +14,10 @@ import { TabList } from '@/ui/layout/tab/components/TabList';
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
import React from 'react';

const StyledCalenderContainer = styled.div`
padding-bottom: ${({ theme }) => theme.spacing(6)};
`;

export const SettingsAccountsCalendarChannelsContainer = () => {
const { activeTabIdState } = useTabList(
SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID,
Expand Down Expand Up @@ -55,10 +60,14 @@ export const SettingsAccountsCalendarChannelsContainer = () => {

return (
<>
<TabList
tabListId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID}
tabs={tabs}
/>
{tabs.length > 1 && (
<StyledCalenderContainer>
<TabList
tabListId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID}
tabs={tabs}
/>
</StyledCalenderContainer>
)}
{calendarChannels.map((calendarChannel) => (
<React.Fragment key={calendarChannel.id}>
{calendarChannel.id === activeTabId && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const StyledDetailsContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(6)};
padding-top: ${({ theme }) => theme.spacing(6)};
`;

export const SettingsAccountsMessageChannelDetails = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import styled from '@emotion/styled';
import { useRecoilValue } from 'recoil';

import { ConnectedAccount } from '@/accounts/types/ConnectedAccount';
Expand All @@ -12,6 +13,10 @@ import { TabList } from '@/ui/layout/tab/components/TabList';
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
import React from 'react';

const StyledMessageContainer = styled.div`
padding-bottom: ${({ theme }) => theme.spacing(6)};
`;

export const SettingsAccountsMessageChannelsContainer = () => {
const { activeTabIdState } = useTabList(
SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID,
Expand Down Expand Up @@ -54,10 +59,14 @@ export const SettingsAccountsMessageChannelsContainer = () => {

return (
<>
<TabList
tabListId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID}
tabs={tabs}
/>
{tabs.length > 1 && (
<StyledMessageContainer>
<TabList
tabListId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID}
tabs={tabs}
/>
</StyledMessageContainer>
)}
{messageChannels.map((messageChannel) => (
<React.Fragment key={messageChannel.id}>
{messageChannel.id === activeTabId && (
Expand Down

0 comments on commit a8dfff3

Please sign in to comment.