-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
2 changed files
with
132 additions
and
92 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,90 +1,94 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
function ArticleCard({width, imgheight, image, title, date, reporter}) { | ||
const oceanlink = "https://www.ohmynews.com/NWS_Web/Series/series_premium_pg.aspx?CNTN_CD=A0002846891"; | ||
function ArticleCard({ width, imgheight, image, title, date, reporter }) { | ||
const oceanlink = | ||
"https://www.ohmynews.com/NWS_Web/Series/series_premium_pg.aspx?CNTN_CD=A0002846891"; | ||
|
||
const handlePopup = () => { | ||
const popup = window.open(oceanlink, 'CardNews', 'width=800, height=600'); | ||
} | ||
const handlePopup = () => { | ||
const popup = window.open(oceanlink, "CardNews", "width=800, height=600"); | ||
}; | ||
|
||
return ( | ||
return ( | ||
<CardWrapper $width={width} onClick={handlePopup}> | ||
<ImageDiv $height={imgheight} src={image} alt="NewsThumbnail" /> | ||
<DescriptionWrapper> | ||
<TitleText>{title}</TitleText> | ||
<SubTextContainer> | ||
<SubText>{date}</SubText> | ||
<SubText>작성자 : {reporter}</SubText> | ||
</SubTextContainer> | ||
</DescriptionWrapper> | ||
<ImageDiv $height={imgheight} src={image} alt="NewsThumbnail" /> | ||
<DescriptionWrapper> | ||
<TitleText>{title}</TitleText> | ||
<SubTextContainer> | ||
<SubText>{date}</SubText> | ||
<SubText>작성자 : {reporter}</SubText> | ||
</SubTextContainer> | ||
</DescriptionWrapper> | ||
</CardWrapper> | ||
); | ||
); | ||
} | ||
|
||
const CardWrapper = styled.button` | ||
all: unset; | ||
all: unset; | ||
width: ${({$width}) => $width}; | ||
height: 80%; | ||
border: 1px solid #ddd; | ||
border-radius: 1vw; | ||
overflow: hidden; | ||
margin: 2vh 1vw; | ||
box-shadow: 0.2vw 0.2vh 0.4vw rgba(0,0,0,0.1); | ||
&:hover { | ||
cursor: pointer; | ||
transform: translateY(-0.5vh); | ||
transition: transform 0.2s ease-in-out; | ||
box-shadow: 0.2vw 0.2vh 0.4vw rgba(0,0,0,0.2); | ||
} | ||
width: ${({ $width }) => $width}; | ||
height: 80%; | ||
border: 1px solid #ddd; | ||
border-radius: 1vw; | ||
overflow: hidden; | ||
margin: 2vh 1vw; | ||
box-shadow: 0.2vw 0.2vh 0.4vw rgba(0, 0, 0, 0.1); | ||
&:hover { | ||
cursor: pointer; | ||
transform: translateY(-0.5vh); | ||
transition: transform 0.2s ease-in-out; | ||
box-shadow: 0.2vw 0.2vh 0.4vw rgba(0, 0, 0, 0.2); | ||
} | ||
&:active { | ||
cursor: pointer; | ||
transform: translateY(0.5vh); | ||
transition: transform 0.2s ease-in-out; | ||
box-shadow: 0.2vw 0.2vh 0.4vw rgba(0, 0, 0, 0.2); | ||
&:active { | ||
cursor: pointer; | ||
transform: translateY(0.5vh); | ||
transition: transform 0.2s ease-in-out; | ||
box-shadow: 0.2vw 0.2vh 0.4vw rgba(0,0,0,0.2); | ||
&:active { opacity: 0.8; } | ||
opacity: 0.8; | ||
} | ||
} | ||
`; | ||
|
||
const ImageDiv = styled.div` | ||
width: 100%; | ||
height: ${({$height}) => $height}; | ||
background-image: url(${({src}) => src}); | ||
background-size: cover; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
width: 100%; | ||
height: ${({ $height }) => $height}; | ||
background-image: url(${({ src }) => src}); | ||
background-size: cover; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
`; | ||
|
||
const DescriptionWrapper = styled.div` | ||
padding: 1vw; | ||
white-space: pre-line; | ||
padding: 1vw; | ||
white-space: pre-line; | ||
`; | ||
|
||
const TitleText = styled.pre` | ||
margin: 0; | ||
color: #333; | ||
font-size: 1.375rem; | ||
font-weight: 700; | ||
line-height: 1.875rem; | ||
letter-spacing: -0.03125rem; | ||
white-space: pre-line; | ||
margin: 0; | ||
color: #333; | ||
font-size: 1.375rem; | ||
font-weight: 700; | ||
line-height: 1.875rem; | ||
letter-spacing: -0.03125rem; | ||
white-space: pre-line; | ||
font-family: "Godo", sans-serif; | ||
`; | ||
|
||
const SubTextContainer = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
height: 100%; | ||
`; | ||
|
||
const SubText = styled.p` | ||
color: #373737; | ||
font-size: 1rem; | ||
font-weight: 300; | ||
line-height: 1.875rem; | ||
letter-spacing: 0.03125rem; | ||
margin-top: 0.5rem; | ||
color: #373737; | ||
font-size: 1rem; | ||
font-weight: 300; | ||
line-height: 1.875rem; | ||
letter-spacing: 0.03125rem; | ||
margin-top: 0.5rem; | ||
`; | ||
|
||
export default ArticleCard; |
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