-
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 #316 from kure-kosen/react/FeatBrogWrap
FeaturedBlogWrapperの実装
- Loading branch information
Showing
7 changed files
with
185 additions
and
31 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,95 @@ | ||
import * as React from "react"; | ||
import { Link } from "react-router-dom"; | ||
import styled from "styled-components"; | ||
|
||
import { chkColors } from "./../commons/color"; | ||
|
||
import * as img from "./../../images/apple-2385198_1280-1.jpg"; | ||
import * as chanyou from "./../../images/chanyou.jpg"; | ||
|
||
export interface IProps { | ||
title: string; | ||
date: string; | ||
summary: string; | ||
author: string; | ||
to: string; | ||
} | ||
export const FeaturedBlog = (props: IProps) => { | ||
const { title, date, summary, author, to } = props; | ||
|
||
return ( | ||
<Link to={to}> | ||
<Wrapper> | ||
<PictureWrapper> | ||
<Picture src={img} /> | ||
</PictureWrapper> | ||
<Article> | ||
<Title>{title}</Title> | ||
<Contents> | ||
<p>{summary}</p> | ||
<Meta> | ||
<span>{date}</span> | ||
<Icon src={chanyou} /> | ||
<span>{author}</span> | ||
</Meta> | ||
</Contents> | ||
</Article> | ||
</Wrapper> | ||
</Link> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
width: 100%; | ||
margin: 20px 0; | ||
`; | ||
|
||
const PictureWrapper = styled.div` | ||
width: 230px; | ||
`; | ||
|
||
const Picture = styled.img` | ||
width: 200px; | ||
height: 100%; | ||
object-fit: cover; | ||
border-radius: 10px; | ||
border: solid 1px ${chkColors.orange}; | ||
`; | ||
|
||
const Article = styled.div` | ||
flex: 1; | ||
`; | ||
|
||
const Title = styled.h3` | ||
margin: 0; | ||
margin-bottom: 20px; | ||
font-size: 1.3rem; | ||
color: ${chkColors.white}; | ||
`; | ||
|
||
const Contents = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: left; | ||
color: ${chkColors.white}; | ||
word-break: break-all; | ||
`; | ||
|
||
const Meta = styled.div` | ||
color: ${chkColors.darkenAqua}; | ||
font-weight: bold; | ||
`; | ||
|
||
const Icon = styled.img` | ||
height: 35px; | ||
width: 35px; | ||
border-radius: 50%; | ||
border: solid 1px ${chkColors.orange}; | ||
object-fit: cover; | ||
margin: 0 10px; | ||
vertical-align: middle; | ||
`; |
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,11 +1,62 @@ | ||
import * as React from "react"; | ||
import styled from "styled-components"; | ||
|
||
export const FeaturedBlogWrapper = () => <FeaturedBlogWrapperStyle>featured-blog-wrapper</FeaturedBlogWrapperStyle>; | ||
import { chkColors } from "./../commons/color"; | ||
|
||
const FeaturedBlogWrapperStyle = styled.div` | ||
width: 100%; | ||
color: white; | ||
background-color: #242424; | ||
height: 600px; | ||
import MoreButton from "./MoreButton"; | ||
|
||
import { FeaturedBlog } from "./FeaturedBlog"; | ||
|
||
export const FeaturedBlogWrapper = () => ( | ||
<Wrapper> | ||
<Title>BLOG</Title> | ||
<BlogWrapper> | ||
<FeaturedBlog | ||
title="news title" | ||
date="YYYY/MM/DD" | ||
summary="人の世界は住みにくい人の世界は住みにくい人の世界は住みにくい。 | ||
人の世界は住みにくい人の世界は住みにくい人の世界は住みにくい。" | ||
author="だれかさん" | ||
to="/blog" | ||
/> | ||
<FeaturedBlog | ||
title="news title" | ||
date="YYYY/MM/DD" | ||
summary="人の世界は住みにくい人の世界は住みにくい人の世界は住みにくい。 | ||
人の世界は住みにくい人の世界は住みにくい人の世界は住みにくい。" | ||
author="だれかさん" | ||
to="/blog" | ||
/> | ||
<FeaturedBlog | ||
title="news title" | ||
date="YYYY/MM/DD" | ||
summary="人の世界は住みにくい人の世界は住みにくい人の世界は住みにくい。 | ||
人の世界は住みにくい人の世界は住みにくい人の世界は住みにくい。" | ||
author="だれかさん" | ||
to="/blog" | ||
/> | ||
</BlogWrapper> | ||
<MoreButton to="/blog" /> | ||
</Wrapper> | ||
); | ||
|
||
const Wrapper = styled.div` | ||
background-color: ${chkColors.aqua}; | ||
margin: 10px; | ||
padding: 50px 40px; | ||
border-radius: 8px; | ||
`; | ||
|
||
const Title = styled.h1` | ||
font-size: 1.5rem; | ||
text-align: center; | ||
color: ${chkColors.white}; | ||
`; | ||
|
||
const BlogWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: center; | ||
`; |
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 * as React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import ChkButtonBase from "./../commons/ChkButtonBase"; | ||
|
||
interface IProps { | ||
to: string; | ||
} | ||
|
||
const MoreButton = (props: IProps) => { | ||
const { to } = props; | ||
|
||
return ( | ||
<MoreButtonWrapper> | ||
<ChkButtonBase text="more" to={to} /> | ||
</MoreButtonWrapper> | ||
); | ||
}; | ||
|
||
const MoreButtonWrapper = styled.div` | ||
margin: 0 auto; | ||
width: 150px; | ||
`; | ||
|
||
export default MoreButton; |
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