-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
41 changed files
with
487 additions
and
309 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,32 @@ | ||
import Image from '@components/Common/Image'; | ||
import { css } from '@emotion/react'; | ||
import React from 'react'; | ||
|
||
interface TipImageProps { | ||
title: string; | ||
webpPath: string; | ||
pngPath: string; | ||
} | ||
|
||
const TipImage = ({ title, webpPath, pngPath }: TipImageProps) => { | ||
return ( | ||
<picture> | ||
<source srcSet={webpPath} type="image/webp" /> | ||
<Image | ||
src={pngPath} | ||
size="tiny" | ||
alt={title} | ||
css={css` | ||
padding: 0 16px 16px 0; | ||
position: absolute; | ||
z-index: -1; | ||
right: 0; | ||
bottom: 0; | ||
opacity: 0.2; | ||
`} | ||
/> | ||
</picture> | ||
); | ||
}; | ||
|
||
export default TipImage; |
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,25 @@ | ||
import styled from '@emotion/styled'; | ||
import React from 'react'; | ||
|
||
interface TipSubTitleProps { | ||
subTitle: string; | ||
} | ||
|
||
const TipSubTitle = ({ subTitle }: TipSubTitleProps) => { | ||
const seperatedSubTitle = subTitle.split('\n'); | ||
return ( | ||
<SubTitle> | ||
{seperatedSubTitle.map((subTitle, index) => ( | ||
<p key={index}>{subTitle}</p> | ||
))} | ||
</SubTitle> | ||
); | ||
}; | ||
|
||
export default TipSubTitle; | ||
|
||
const SubTitle = styled.span` | ||
padding: 0 0 0 16px; | ||
line-height: 1rem; | ||
font-size: 0.8rem; | ||
`; |
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,26 @@ | ||
import styled from '@emotion/styled'; | ||
import React from 'react'; | ||
|
||
interface TipTitleProps { | ||
title: string; | ||
} | ||
|
||
const TipTitle = ({ title }: TipTitleProps) => { | ||
const seperatedTitle = title.split('\n'); | ||
return ( | ||
<Title> | ||
{seperatedTitle.map((titleItem, index) => ( | ||
<p key={index}>{titleItem}</p> | ||
))} | ||
</Title> | ||
); | ||
}; | ||
|
||
export default TipTitle; | ||
|
||
const Title = styled.span` | ||
padding: 20px 0px 10px 16px; | ||
line-height: 1.2rem; | ||
font-size: 1.2rem; | ||
font-weight: bold; | ||
`; |
21 changes: 21 additions & 0 deletions
21
src/components/Card/TipCard/domain/getTipCardSubElement.ts
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,21 @@ | ||
import { Children, isValidElement } from 'react'; | ||
|
||
import TipImage from '../TipImage'; | ||
import TipSubTitle from '../TipSubTitle'; | ||
import TipTitle from '../TipTitle'; | ||
|
||
type TipCardChildType = typeof TipTitle | typeof TipSubTitle | typeof TipImage; | ||
|
||
const getTipCardSubElement = ( | ||
children: React.ReactNode, | ||
childType: TipCardChildType, | ||
) => { | ||
const chidrenArray = Children.toArray(children); | ||
const targetChild = chidrenArray | ||
.filter((child) => isValidElement(child) && child.type === childType) | ||
.slice(0, 2); | ||
|
||
return targetChild; | ||
}; | ||
|
||
export default getTipCardSubElement; |
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,47 @@ | ||
import styled from '@emotion/styled'; | ||
import { THEME } from '@styles/ThemeProvider/theme'; | ||
import React from 'react'; | ||
|
||
import getTipCardSubElement from './domain/getTipCardSubElement'; | ||
import TipImage from './TipImage'; | ||
import TipSubTitle from './TipSubTitle'; | ||
import TipTitle from './TipTitle'; | ||
|
||
type StrictPropsWithChildren<T = unknown> = T & { | ||
children: React.ReactNode; | ||
onClick: () => void; | ||
}; | ||
|
||
const TipCard = ({ children, onClick }: StrictPropsWithChildren) => { | ||
const tipTitle = getTipCardSubElement(children, TipTitle); | ||
const tipSubTitle = getTipCardSubElement(children, TipSubTitle); | ||
const tipImage = getTipCardSubElement(children, TipImage); | ||
|
||
return ( | ||
<Container onClick={onClick}> | ||
{tipTitle} | ||
{tipSubTitle} | ||
{tipImage} | ||
</Container> | ||
); | ||
}; | ||
|
||
export default TipCard; | ||
|
||
TipCard.TipTitle = TipTitle; | ||
TipCard.TipSubTitle = TipSubTitle; | ||
TipCard.TipImage = TipImage; | ||
|
||
const Container = styled.div` | ||
position: relative; | ||
height: 10rem; | ||
width: 10rem; | ||
display: flex; | ||
flex-direction: column; | ||
background-color: ${THEME.PRIMARY}20; | ||
border: 1px solid ${THEME.PRIMARY}30; | ||
border-radius: 10px; | ||
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); | ||
gap: 5px; | ||
z-index: 1; | ||
`; |
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,28 @@ | ||
import styled from '@emotion/styled'; | ||
import { THEME } from '@styles/ThemeProvider/theme'; | ||
import React from 'react'; | ||
|
||
interface InformSubTitleProps { | ||
subTitle: string; | ||
} | ||
|
||
const InformSubTitle = ({ subTitle }: InformSubTitleProps) => { | ||
const seperatedSubTitle = subTitle.split('\n'); | ||
|
||
return ( | ||
<SubTitle> | ||
{seperatedSubTitle.map((subTitle, index) => ( | ||
<p key={index}>{subTitle}</p> | ||
))} | ||
</SubTitle> | ||
); | ||
}; | ||
|
||
export default InformSubTitle; | ||
|
||
const SubTitle = styled.span` | ||
padding: 0 0 1rem 0; | ||
color: ${THEME.TEXT.GRAY}; | ||
line-height: 1.3; | ||
font-size: 0.9rem; | ||
`; |
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,20 @@ | ||
import styled from '@emotion/styled'; | ||
import { THEME } from '@styles/ThemeProvider/theme'; | ||
import React from 'react'; | ||
|
||
interface InformTitleProps { | ||
title: string; | ||
} | ||
|
||
const InformTitle = ({ title }: InformTitleProps) => { | ||
return <Title>{title}</Title>; | ||
}; | ||
|
||
export default InformTitle; | ||
|
||
const Title = styled.span` | ||
padding: 1.5rem 0 1.5rem 0; | ||
color: ${THEME.TEXT.BLACK}; | ||
font-size: 1.5rem; | ||
font-weight: bold; | ||
`; |
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,35 @@ | ||
import Button from '@components/Common/Button'; | ||
import { css } from '@emotion/react'; | ||
import { THEME } from '@styles/ThemeProvider/theme'; | ||
import React from 'react'; | ||
|
||
interface InformTypeButtonProps { | ||
type: string; | ||
isActive: boolean; | ||
onClick: () => void; | ||
} | ||
|
||
const InformTypeButton = ({ | ||
type, | ||
isActive, | ||
onClick, | ||
}: InformTypeButtonProps) => { | ||
return ( | ||
<Button | ||
css={css` | ||
height: 2rem; | ||
width: 4rem; | ||
border-radius: 4rem; | ||
font-size: 0.7rem; | ||
font-weight: normal; | ||
background-color: ${isActive ? THEME.BUTTON.BLUE : THEME.BUTTON.GRAY}; | ||
color: ${isActive ? THEME.TEXT.WHITE : THEME.TEXT.GRAY}; | ||
`} | ||
onClick={onClick} | ||
> | ||
{type} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default InformTypeButton; |
24 changes: 24 additions & 0 deletions
24
src/components/InformUpperLayout/domain/getInformUpperLayoutSubElement.ts
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,24 @@ | ||
import { Children, isValidElement } from 'react'; | ||
|
||
import InformSubTitle from '../InformSubTitle'; | ||
import InformTitle from '../InformTitle'; | ||
import InformTypeButton from '../InformTypeButton'; | ||
|
||
type InformUpperLayoutChildType = | ||
| typeof InformTitle | ||
| typeof InformSubTitle | ||
| typeof InformTypeButton; | ||
|
||
const getInformUpperLayoutSubElement = ( | ||
children: React.ReactNode, | ||
childType: InformUpperLayoutChildType, | ||
) => { | ||
const childrenArray = Children.toArray(children); | ||
const targetChild = childrenArray | ||
.filter((child) => isValidElement(child) && child.type === childType) | ||
.slice(0, 2); | ||
|
||
return targetChild; | ||
}; | ||
|
||
export default getInformUpperLayoutSubElement; |
Oops, something went wrong.