Skip to content

Commit

Permalink
fix: close sider button appears now
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyMarin committed Jul 15, 2024
1 parent a40364b commit a8bcbf6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
32 changes: 16 additions & 16 deletions src/components/header/layouts/MobileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ const handleTouchStart = (event: React.TouchEvent) => {
export const MobileHeader: React.FC<MobileHeaderProps> = ({ toggleSider, isSiderOpened }) => {
return (
<BaseRow style={{ width: '100%' }} justify="space-between" align="middle">
<BaseCol>
<ProfileDropdown />
</BaseCol>
<BaseCol>{!isSiderOpened && <ProfileDropdown />}</BaseCol>

<BaseCol>
<BaseRow align="middle">
<BaseCol className="mobile-header-button">
<NotificationsDropdown />
</BaseCol>

<BaseCol className="mobile-header-button">
<HeaderSearch />
</BaseCol>

<BaseCol className="mobile-header-button">
<SettingsDropdown />
</BaseCol>
</BaseRow>
{!isSiderOpened && (
<BaseRow align="middle">
<BaseCol className="mobile-header-button">
<NotificationsDropdown />
</BaseCol>

<BaseCol className="mobile-header-button">
<HeaderSearch />
</BaseCol>

<BaseCol className="mobile-header-button">
<SettingsDropdown />
</BaseCol>
</BaseRow>
)}
</BaseCol>

<S.BurgerCol className="mobile-header-button">
Expand Down
7 changes: 7 additions & 0 deletions src/components/layouts/main/MainHeader/MainHeader.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import styled, { css } from 'styled-components';

interface Header {
$isTwoColumnsLayoutHeader: boolean;
$isSiderOpened: boolean;
}

export const Header = styled(BaseLayout.Header)<Header>`
line-height: 1.5;
z-index: 100;
${(props) =>
props.$isSiderOpened &&
css`
background-color: rgba(0, 0, 0, 0) !important;
z-index: 105;
`}
position: sticky;
position: -webkit-sticky;
top: 0;
Expand Down
9 changes: 7 additions & 2 deletions src/components/layouts/main/MainHeader/MainHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import * as S from './MainHeader.styles';

interface MainHeaderProps extends WithChildrenProps {
isTwoColumnsLayout: boolean;
isSiderOpened: boolean;
}

export const MainHeader: React.FC<MainHeaderProps> = ({ isTwoColumnsLayout, children }) => {
return <S.Header $isTwoColumnsLayoutHeader={isTwoColumnsLayout}>{children}</S.Header>;
export const MainHeader: React.FC<MainHeaderProps> = ({ isTwoColumnsLayout, isSiderOpened, children }) => {
return (
<S.Header $isSiderOpened={isSiderOpened} $isTwoColumnsLayoutHeader={isTwoColumnsLayout}>
{children}
</S.Header>
);
};
4 changes: 2 additions & 2 deletions src/components/layouts/main/MainLayout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ const MainLayout: React.FC = () => {

return (
<S.LayoutMaster>
<MainSider isCollapsed={siderCollapsed} setCollapsed={setSiderCollapsed} />
<S.LayoutMain>
<MainHeader isTwoColumnsLayout={isTwoColumnsLayout}>
<MainHeader isSiderOpened={!siderCollapsed} isTwoColumnsLayout={isTwoColumnsLayout}>
<Header toggleSider={toggleSider} isSiderOpened={!siderCollapsed} isTwoColumnsLayout={isTwoColumnsLayout} />
</MainHeader>
<MainContent
Expand All @@ -73,6 +72,7 @@ const MainLayout: React.FC = () => {
{!isTwoColumnsLayout && <References />}
</MainContent>
</S.LayoutMain>
<MainSider isCollapsed={siderCollapsed} setCollapsed={setSiderCollapsed} />
</S.LayoutMaster>
);
};
Expand Down

0 comments on commit a8bcbf6

Please sign in to comment.