Skip to content

Commit ba0570e

Browse files
committed
Add new props - start year and end year
1 parent 26d4dcc commit ba0570e

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

build/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/content_body/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import PropTypes from 'prop-types';
33
import styled from 'styled-components';
44

55
const BodyComponent = styled.div`
6-
color: #002a3a;
76
font-size: 0.9em;
8-
padding-bottom: 20px;
7+
padding-bottom: 30px;
98
padding-left: 15px;
109
position: relative;
1110
@@ -14,8 +13,8 @@ const BodyComponent = styled.div`
1413
}
1514
1615
&::before {
17-
background-color: #ccc;
1816
content: '';
17+
background-color: #cccccc;
1918
height: 100%;
2019
left: -3px;
2120
min-height: 95%;
@@ -26,8 +25,10 @@ const BodyComponent = styled.div`
2625
`;
2726

2827
const BodyComponentTitle = styled.p`
28+
color: #002a3a;
2929
font-weight: bold;
30-
margin-bottom: 5px;
30+
margin-bottom: 10px;
31+
font-size: 18px;
3132
margin-top: 0;
3233
text-align: left;
3334
`;

src/components/content_year/index.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,38 @@ const YearComponentItem = styled.div`
2727
margin-bottom: 8px;
2828
`;
2929

30-
const compare = (a, b) => {
31-
if (a < b) return 1;
32-
if (b < a) return -1;
33-
return 0;
34-
};
35-
36-
const handleEachYears = years =>
37-
years.sort(compare).map(year => (
38-
<YearComponentItem key={year} className="item-year-component">
39-
{year}
40-
</YearComponentItem>
41-
));
42-
4330
const ContentYear = props => {
44-
const { years } = props;
31+
const { startYear, endYear, current } = props;
4532

4633
return (
4734
<YearComponent className="year-component">
48-
{handleEachYears(years)}
35+
{current ? (
36+
<>
37+
<YearComponentItem className="item-year-component">
38+
{endYear}
39+
</YearComponentItem>
40+
<YearComponentItem className="item-year-component">
41+
{startYear}
42+
</YearComponentItem>
43+
</>
44+
) : (
45+
<YearComponentItem className="item-year-component">
46+
{startYear}
47+
</YearComponentItem>
48+
)}
4949
</YearComponent>
5050
);
5151
};
5252

53+
ContentYear.defaultProps = {
54+
current: false,
55+
endYear: 0
56+
};
57+
5358
ContentYear.propTypes = {
54-
years: PropTypes.arrayOf(PropTypes.string).isRequired
59+
startYear: PropTypes.number.isRequired,
60+
endYear: PropTypes.number,
61+
current: PropTypes.bool
5562
};
5663

5764
export default ContentYear;

src/components/description/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import PropTypes from 'prop-types';
33
import styled from 'styled-components';
44

55
const DescriptionComponent = styled.div`
6-
margin-bottom: 10px;
7-
margin-top: 10px;
6+
margin-top: 5px;
87
text-align: left;
98
`;
109

0 commit comments

Comments
 (0)