-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from in63119/feature/layout
feat: 공통 Layout 추가
- Loading branch information
Showing
14 changed files
with
224 additions
and
167 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createGlobalStyle } from 'styled-components'; | ||
|
||
const GlobalStyle = createGlobalStyle` | ||
* { | ||
touch-action: manipulation; | ||
box-sizing: border-box; | ||
} | ||
i { | ||
font-style: normal; | ||
} | ||
input, | ||
button { | ||
font-family: inherit; | ||
} | ||
button { | ||
cursor: pointer; | ||
&:disabled { | ||
cursor: not-allowed; | ||
} | ||
} | ||
/** | ||
https://css-tricks.com/snippets/css/change-autocomplete-styles-webkit-browsers/ | ||
*/ | ||
input:-webkit-autofill { | ||
-webkit-box-shadow: 0 0 0 1000px transparent inset; | ||
} | ||
input:-webkit-autofill, | ||
input:-webkit-autofill:hover, | ||
input:-webkit-autofill:focus, | ||
input:-webkit-autofill:active { | ||
transition: background-color 5000s ease-in-out 0s; | ||
} | ||
`; | ||
|
||
export default GlobalStyle; |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
interface HeaderProps { | ||
hasGoback: boolean; | ||
handleClickGoBack: () => void; | ||
} | ||
|
||
const Header: React.FC<HeaderProps> = (props) => { | ||
const { hasGoback, handleClickGoBack } = props; | ||
|
||
return ( | ||
<Container> | ||
<LeftMenu onClick={handleClickGoBack}>{hasGoback && <GobackIcon src="/images/icon_goBack.png" />}</LeftMenu> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Header; | ||
|
||
export const HEADER_HEIGHT = 44; | ||
|
||
const Container = styled.div` | ||
padding: 6px 14px; | ||
display: flex; | ||
align-items: center; | ||
width: 100%; | ||
height: ${HEADER_HEIGHT}px; | ||
`; | ||
|
||
const LeftMenu = styled.div` | ||
cursor: pointer; | ||
`; | ||
|
||
const GobackIcon = styled.img` | ||
width: 24px; | ||
height: 24px; | ||
`; |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { HEADER_HEIGHT } from 'components/Header'; | ||
import { styled } from 'styled-components'; | ||
|
||
export const ParentLayout = styled.div` | ||
width: 100%; | ||
height: calc(100vh - ${HEADER_HEIGHT}px); | ||
padding: 12px 20px 0; | ||
position: relative; | ||
overflow: scroll; | ||
`; | ||
|
||
export const Body = styled.div` | ||
width: 100%; | ||
margin-top: 48px; | ||
`; | ||
|
||
export const Title = styled.div` | ||
font-size: 20px; | ||
font-weight: 600; | ||
line-height: 28px; | ||
white-space: pre-wrap; | ||
`; | ||
|
||
export const SubTitle = styled.div<{ color: string }>` | ||
margin-top: 8px; | ||
font-size: 15px; | ||
font-weight: 400; | ||
line-height: 19px; | ||
color: ${({ color }) => color}; | ||
white-space: pre-wrap; | ||
`; | ||
|
||
export const FooterWrapper = styled.div` | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
padding: 0 20px 15px; | ||
`; | ||
|
||
export const MarginBottom = styled.div` | ||
/* TODO: 40px 보장 */ | ||
height: 180px; | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import * as Styled from './index.styled'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import Header from 'components/Header'; | ||
|
||
interface LayoutProps { | ||
hasGoback?: boolean; | ||
title: { | ||
text: string; | ||
}; | ||
subTitle?: { | ||
text: string; | ||
color?: string; | ||
}; | ||
children: React.ReactNode; | ||
} | ||
|
||
const Layout: React.FC<LayoutProps> = ({ children, hasGoback = true, title, subTitle }) => { | ||
const navigate = useNavigate(); | ||
|
||
const goBackHandler = () => { | ||
navigate(-1); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Header hasGoback={hasGoback} handleClickGoBack={goBackHandler} /> | ||
<Styled.ParentLayout> | ||
<Styled.Title>{title.text}</Styled.Title> | ||
{subTitle && <Styled.SubTitle color={subTitle.color ?? '#696969'}>{subTitle.text}</Styled.SubTitle>} | ||
{children} | ||
<Styled.MarginBottom /> | ||
</Styled.ParentLayout> | ||
</> | ||
); | ||
}; | ||
|
||
export default Object.assign(Layout, { | ||
Body: Styled.Body, | ||
Footer: Styled.FooterWrapper, | ||
}); |
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
Oops, something went wrong.