-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
userjmmm
authored and
userjmmm
committed
Aug 4, 2024
1 parent
9fa9ea0
commit 342494d
Showing
3 changed files
with
53 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,44 @@ | ||
import styled from '@emotion/styled'; | ||
import { ReactNode } from 'react'; | ||
|
||
import { HEADER_HEIGHT } from '@/components/features/Layout/Header'; | ||
import { breakpoints } from '@/styles/variants'; | ||
|
||
import { Container } from '../Container'; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
sidebar: React.ReactNode; | ||
type SplitLayoutProps = { | ||
sidebar: ReactNode; | ||
children: ReactNode; | ||
}; | ||
|
||
export const SplitLayout = ({ children, sidebar }: Props) => { | ||
export const SplitLayout = ({ sidebar, children }: SplitLayoutProps) => { | ||
return ( | ||
<Wrapper> | ||
<Container maxWidth={breakpoints.lg}> | ||
<Inner> | ||
<Main>{children}</Main> | ||
<Sidebar>{sidebar}</Sidebar> | ||
</Inner> | ||
</Container> | ||
</Wrapper> | ||
<Container> | ||
<MainContent>{children}</MainContent> | ||
<Sidebar>{sidebar}</Sidebar> | ||
</Container> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
width: 100%; | ||
`; | ||
|
||
const Inner = styled.div` | ||
width: 100%; | ||
const Container = styled.div` | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
position: relative; | ||
`; | ||
const Main = styled.main` | ||
width: 100%; | ||
max-width: 900px; | ||
@media (max-width: 768px) { | ||
flex-direction: column; | ||
} | ||
`; | ||
|
||
const Sidebar = styled.aside` | ||
display: none; | ||
position: sticky; | ||
top: ${HEADER_HEIGHT}; | ||
width: 100%; | ||
max-width: 360px; | ||
height: calc(100vh - ${HEADER_HEIGHT}); | ||
const MainContent = styled.div` | ||
flex: 2; | ||
padding: 20px; | ||
@media screen and (min-width: ${breakpoints.sm}) { | ||
display: block; | ||
@media (max-width: 768px) { | ||
order: 1; | ||
padding: 10px; | ||
} | ||
`; | ||
|
||
const Sidebar = styled.div` | ||
flex: 1; | ||
padding: 20px; | ||
@media (max-width: 768px) { | ||
order: 2; | ||
padding: 10px; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters