Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 0d38481

Browse files
author
z
committed
1. modified lean cards
2. changed time icon to calendar in events 3. fluid prop to button added
1 parent f77e250 commit 0d38481

File tree

4 files changed

+82
-37
lines changed

4 files changed

+82
-37
lines changed

components/events/event-card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import styled from 'react-emotion';
33
import { space, fontSize } from 'styled-system';
44
import { Flex, Box } from 'grid-emotion';
5-
import TimeIcon from 'react-icons/lib/md/access-time';
5+
import TimeIcon from 'react-icons/lib/fa/calendar';
66
import format from 'date-fns/format';
77
import LocationIcon from 'react-icons/lib/md/location-on';
88
import AttendeesIcon from 'react-icons/lib/md/people';

components/learn/subject-card.js

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
11
import React from 'react';
22
import styled from 'react-emotion';
3+
import { Flex, Box } from 'grid-emotion';
34
import Link from 'next/link';
5+
import LearningIcon from 'react-icons/lib/fa/book';
6+
import EstimateIcon from 'react-icons/lib/md/access-time';
47

5-
import { breakpoints } from '../../utils/base.styles';
8+
import { breakpoints, Button } from '../../utils/base.styles';
69

7-
const Subject = styled.a`
10+
const SubjectCard = styled.div`
811
text-decoration: none;
9-
width: calc(33.33% - 40px);
10-
margin: 20px;
12+
width: calc(25% - 40px);
13+
margin-top: 20px;
1114
display: inline-block;
1215
min-height: 200px;
13-
background: #fff;
16+
background: #fafafa;
1417
border: 1px solid #b9b9b9;
1518
transition: all 0.25s;
16-
cursor: pointer;
17-
&:hover {
18-
border: 1px solid #000;
19-
}
20-
& .icon {
19+
& .logo {
20+
text-align: center;
2121
padding: 10px 15px;
2222
font-size: 10rem;
2323
${breakpoints.xs} {
2424
font-size: 8rem;
2525
}
2626
}
2727
& .content {
28-
padding: 10px 0 10px 30px;
28+
padding: 10px;
2929
color: #444;
30-
background: #f6f6f6;
30+
background: #fff;
3131
text-align: left;
3232
}
3333
& .title {
3434
font-size: 1.5rem;
3535
font-size: 600;
3636
color: #222;
37+
padding-bottom: 0.4rem;
3738
${breakpoints.xs} {
3839
font-size: 1.2rem;
3940
}
4041
}
4142
& .subtitle {
4243
font-size: 0.8rem;
43-
color: #444;
44+
color: #8393a7;
45+
padding-bottom: 0.4rem;
46+
}
47+
& .stats {
48+
color: #8393a7;
49+
font-size: 0.8rem;
50+
padding-bottom: 0.4rem;
51+
}
52+
& .icons {
53+
font-size: 1.1rem;
54+
margin-right: 0.25rem;
55+
color: #8393a7;
56+
}
57+
& .view {
58+
width: 100%;
59+
display: flex;
60+
text-align: center;
4461
}
4562
${breakpoints.md} {
4663
width: calc(50% - 40px);
@@ -56,15 +73,30 @@ const Subject = styled.a`
5673
`;
5774

5875
export default ({ subject }) => (
59-
<Link href={`/learn/subject?id=${subject.subjectId}`} as={subject.url}>
60-
<Subject href={subject.url}>
61-
<div className="icon">
62-
<i className={subject.icon} />
63-
</div>
64-
<div className="content">
65-
<div className="title">{subject.title}</div>
66-
<div className="subtitle">{subject.domain}</div>
76+
<SubjectCard>
77+
<div className="logo">
78+
<i className={subject.icon} />
79+
</div>
80+
<div className="content">
81+
<div className="title">{subject.title}</div>
82+
<div className="subtitle">{subject.domain}</div>
83+
<Flex className="stats">
84+
<Box pr={1}>
85+
<LearningIcon className="icons" />
86+
20 learning
87+
</Box>
88+
<Box>
89+
<EstimateIcon className="icons" />
90+
20 hours
91+
</Box>
92+
</Flex>
93+
</div>
94+
<Link href={`/learn/subject?id=${subject.subjectId}`} as={subject.url}>
95+
<div className="view">
96+
<Button inverted small fluid href={subject.url}>
97+
VIEW GUIDE
98+
</Button>
6799
</div>
68-
</Subject>
69-
</Link>
100+
</Link>
101+
</SubjectCard>
70102
);

pages/learn/index.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,43 @@ import { space } from 'styled-system';
66
import Layout from '../../components/common/layout';
77
import BannerSection from '../../components/common/banner';
88
import SubjectCard from '../../components/learn/subject-card';
9-
import { Container } from '../../utils/base.styles';
9+
import { baseContainer, graySecondary } from '../../utils/base.styles';
1010
import { listOfSubjects } from '../../utils/mock-data';
1111

12-
const SubjectsSection = styled.section`
12+
const LearnSection = styled.section`
1313
${space};
14-
background: #fff;
15-
text-align: center;
14+
${baseContainer};
1615
position: relative;
1716
`;
1817

18+
const FilterContainer = styled.div`
19+
${space};
20+
border-bottom: 1px solid ${graySecondary};
21+
& .title_filter {
22+
text-align: center;
23+
}
24+
& .title_fitler_by {
25+
font-weight: 400;
26+
}
27+
`;
28+
1929
export default () => (
2030
<Layout>
2131
<BannerSection
2232
textInverted
2333
title="Open Source Learning Guides"
2434
subTitle="Open Source Learning Guides to master your favorite technology"
2535
/>
26-
<SubjectsSection py={[2, 4]} px={[2, 1]}>
27-
<Container>
28-
<Flex justify="center" align="center" wrap>
29-
{listOfSubjects.map(subject => {
30-
return <SubjectCard key={subject.url} subject={subject} />;
31-
})}
32-
</Flex>
33-
</Container>
34-
</SubjectsSection>
36+
<LearnSection py={[2, 3]} px={[2, 1]}>
37+
<FilterContainer my={[1, 2]}>
38+
<h3 className="title_filter">Available Guides</h3>
39+
<h4 className="title_fitler_by">Filter by domain :</h4>
40+
</FilterContainer>
41+
<Flex justify="space-between" align="center" wrap>
42+
{listOfSubjects.map(subject => {
43+
return <SubjectCard key={subject.url} subject={subject} />;
44+
})}
45+
</Flex>
46+
</LearnSection>
3547
</Layout>
3648
);

utils/base.styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const baseButton = css`
5252

5353
export const Button = styled.a`
5454
${baseButton};
55+
width: ${props => (props.fluid ? '100%' : 'auto')}
5556
background: ${props => (props.inverted ? '#7657fb' : props.ghost ? '#fff' : '#fff')}
5657
color: ${props => (props.inverted ? '#fff' : props.ghost ? purpleSecondary : '#222')}
5758
padding: ${props =>

0 commit comments

Comments
 (0)