Skip to content

Commit 0ab506a

Browse files
committed
remove rebass and update deps
1 parent 98057ff commit 0ab506a

File tree

4 files changed

+1070
-234
lines changed

4 files changed

+1070
-234
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
},
2323
"homepage": "https://github.com/js-ni/js-ni-medium-posts#readme",
2424
"dependencies": {
25-
"ky": "0.4.1",
26-
"rebass": "3.0.0-9"
25+
"@nerdify/styled-system-primitives": "0.1.0",
26+
"ky": "0.11.0"
2727
},
2828
"devDependencies": {
29-
"microbundle": "0.7.0"
29+
"microbundle": "0.11.0"
3030
},
3131
"peerDependencies": {
32-
"react": "^16.7.0-alpha.0",
33-
"react-dom": "^16.7.0-alpha.0",
34-
"styled-components": "^4.0.2"
32+
"@emotion/styled": "^10.0.11",
33+
"react": "^16.8.6",
34+
"react-dom": "^16.8.6"
3535
},
3636
"publishConfig": {
3737
"access": "public"

src/components/Article/index.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import React from 'react';
2-
import {Card, Heading, Link, Text} from 'rebass';
2+
import {Box, Heading, Text} from '@nerdify/styled-system-primitives';
33

4-
function Article(props) {
4+
function Article({article}) {
55
return (
6-
<Card
6+
<Box
77
as="article"
88
bg="white"
9-
borderRadius={4}
10-
boxShadow="0px 4px 6px rgba(0, 0, 0, 0.1)"
119
p={20}
10+
style={{borderRadius: 4, boxShadow: '0px 4px 6px rgba(0, 0, 0, 0.1)'}}
1211
>
13-
<Link color="#222" href={props.url}>
14-
<Heading as="h3" children={props.title} fontWeight="normal" mb="4px" />
15-
</Link>
16-
<Text as="time" color="#aaa" children={props.createdAt} />
17-
<Text children={props.subtitle} color="#888" mt={16} />
18-
</Card>
12+
<Text as="a" color="#222" href={article.url}>
13+
<Heading as="h3" children={article.title} fontSize={24} mb="4px" />
14+
</Text>
15+
<Text as="time" color="#aaa" children={article.createdAt} />
16+
<Text children={article.subtitle} color="#888" mt={16} />
17+
</Box>
1918
);
2019
}
2120

src/components/Feed/index.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import ky from 'ky';
22
import React, {useEffect, useState} from 'react';
3-
import {Box, Flex, Heading, Text} from 'rebass';
3+
import {Box, Heading, Text} from '@nerdify/styled-system-primitives';
44

55
import Article from '../Article';
66

7-
let API_ENDPOINT = 'https://js-ni-blog-api.herokuapp.com';
7+
const API_ENDPOINT = 'https://js-ni-blog-api.herokuapp.com';
88

99
function Feed() {
10-
let [loading, setLoading] = useState(true);
11-
let [posts, setPosts] = useState([]);
12-
13-
useEffect(async () => {
14-
let data = await ky(API_ENDPOINT).json();
15-
16-
setPosts(data);
17-
setLoading(false);
10+
const [loading, setLoading] = useState(true);
11+
const [posts, setPosts] = useState([]);
12+
13+
useEffect(() => {
14+
ky(API_ENDPOINT)
15+
.json()
16+
.then(data => {
17+
setPosts(data);
18+
setLoading(false);
19+
});
1820
}, []);
1921

2022
return (
2123
<React.Fragment>
22-
<Flex alignItems="flex-end" justifyContent="space-between">
23-
<Heading fontSize={28} fontWeight="normal">
24+
<Box alignItems="flex-end" display="flex" justifyContent="space-between">
25+
<Heading fontSize={32} fontWeight="normal">
2426
Blog
2527
</Heading>
2628
<Text
@@ -30,16 +32,16 @@ function Feed() {
3032
>
3133
Ver más artículos
3234
</Text>
33-
</Flex>
35+
</Box>
3436

3537
{loading ? (
36-
<Text fontSize={16} mt={15}>
38+
<Text fontSize={16} mt={16}>
3739
Cargando publicaciones...
3840
</Text>
3941
) : (
4042
posts.map(post => (
4143
<Box key={post.url} mt={16}>
42-
<Article {...post} />
44+
<Article article={post} />
4345
</Box>
4446
))
4547
)}

0 commit comments

Comments
 (0)