-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathOpinionStory.jsx
74 lines (63 loc) · 1.38 KB
/
OpinionStory.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import React from 'react';
import styled from 'styled-components';
import { COLORS, QUERIES } from '../../constants';
const OpinionStory = ({ id, title, author, avatar }) => {
return (
<>
<a href={`/story/${id}`}>
<Wrapper>
<Avatar alt="" src={avatar} />
<div>
<AuthorName>{author}</AuthorName>
<ArticleTitle>{title}</ArticleTitle>
</div>
</Wrapper>
</a>
<Divider />
</>
);
};
const Divider = styled.hr`
size: 1px;
width: 100%;
margin: 16px 0px;
padding-left: 32px;
border: none;
border-top: 1px solid ${COLORS.gray[300]};
&:last-of-type {
display: none;
}
@media ${QUERIES.tabletOnly} {
display: none;
}
`
const Wrapper = styled.article`
color: var(--color-gray-900);
@media not (${QUERIES.tabletOnly}) {
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
}
`;
const Avatar = styled.img`
display: block;
width: 48px;
height: 48px;
border-radius: 50%;
object-fit: cover;
@media ${QUERIES.laptopAndUp} {
display: revert;
}
`;
const AuthorName = styled.p`
font-size: 1.125rem;
font-weight: var(--font-weight-medium);
color: var(--color-gray-700);
margin-bottom: 4px;
`;
const ArticleTitle = styled.h3`
font-size: 1.125rem;
font-weight: var(--font-weight-bold);
line-height: 1.3;
`;
export default OpinionStory;