Skip to content

Commit 5de606c

Browse files
author
Turbo
committed
Refactor page
1 parent 91b85d9 commit 5de606c

File tree

36 files changed

+136
-181
lines changed

36 files changed

+136
-181
lines changed

src/App/RouteComponents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Route, Switch } from 'react-router';
44
import Header from 'src/Components/Header';
55
import Footer from 'src/Components/Footer';
66
import Loading from 'src/Components/Loading';
7-
import { RedirectWithStatus } from 'src/Components/SSR';
7+
import { RedirectWithStatus } from 'src/Components/Route';
88

99
/*
1010
* Create a Universal Component template, allowing SSR a component + Code Splitting

src/Components/Footer/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import { Image, Box } from 'rebass';
4-
import FlexBox from 'src/Components/FlexBox';
5-
import { TextBlock } from 'src/Components/Typo';
4+
import { FlexBox } from 'src/Components/Layout';
5+
import { Text } from 'src/Components/Typo';
66

77
const imagePath = require('src/static/images/full-logo.svg');
88

9-
const BoxWithFooter = Box.withComponent('footer');
10-
11-
const StyledFooter = styled(BoxWithFooter)`
9+
const StyledFooter = styled(Box)`
1210
width: 100%;
1311
min-height: max-content;
1412
position: absolute;
@@ -19,13 +17,13 @@ const StyledFooter = styled(BoxWithFooter)`
1917
`;
2018

2119
const Footer = () => (
22-
<StyledFooter py={[2, 3, 4]} px={[3, 4, 5]}>
20+
<StyledFooter as="footer" py={[2, 3, 4]} px={[3, 4, 5]}>
2321
<FlexBox>
2422
<Image src={imagePath} alt="Brightizen" width="100px" />
2523

26-
<TextBlock color="black">
24+
<Text color="black">
2725
Copyright © 2018 Brightizen
28-
</TextBlock>
26+
</Text>
2927
</FlexBox>
3028
</StyledFooter>
3129
);

src/Components/FormElements/Form/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import PropTypes from 'prop-types';
4-
import FlexBox from 'src/Components/FlexBox';
4+
import { FlexBox } from 'src/Components/Layout';
55

66
const Form = ({ children, submit, ...rest }) => (
77
<FlexBox {...rest}>

src/Components/FormElements/Input/InputField/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import PropTypes from 'prop-types';
4-
// import Container from 'src/Components/Container';
4+
// import { Container } from 'src/Components/Layout';
55

66
const arrowDown = 'static/icons/arrow_solid_black.svg';
77

@@ -52,8 +52,6 @@ const StyledInputField = styled.input`
5252
}
5353
`;
5454

55-
// const StyledContainerInput = StyledInputField.withComponent('input');
56-
5755
const InputField = ({
5856
id, placeholder, type, ...rest
5957
}) => (

src/Components/FormElements/Input/Label/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import { Text } from 'rebass';
66
const Label = ({
77
id, label, children, ...rest
88
}) => (
9-
<StyledLabel htmlFor={id} {...rest}>
9+
<StyledLabel as="label" htmlFor={id} {...rest}>
1010
{label}
1111
{children}
1212
</StyledLabel>
1313
);
1414

15-
const TextWithLabel = Text.withComponent('label');
16-
17-
const StyledLabel = styled(TextWithLabel)`
15+
const StyledLabel = styled(Text)`
1816
font-family: ${props => props.theme.fonts.body};
1917
display: flex;
2018
flex-direction: column;

src/Components/FormElements/Input/Validation/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import PropTypes from 'prop-types';
4-
import { Span } from 'src/Components/Typo';
4+
import { Text } from 'src/Components/Typo';
55

66
const FormValidation = ({
77
isShow, messageType, message, ...rest
88
}) => (
9-
<StyledFormValidation isShow={isShow} messageType={messageType} {...rest}>
9+
<StyledFormValidation as="span" isShow={isShow} messageType={messageType} {...rest}>
1010
{message}
1111
</StyledFormValidation>
1212
);
1313

14-
const StyledFormValidation = styled(Span)`
14+
const StyledFormValidation = styled(Text)`
1515
width: 100%;
1616
display: ${props => (props.isShow ? 'block' : 'none')};
1717
color: ${props => (props.messageType ? props.theme.colors[props.messageType] : props.theme.colors.black)};

src/Components/FormElements/Input/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
import FlexBox from 'src/Components/FlexBox';
4+
import { FlexBox } from 'src/Components/Layout';
55
import Label from './Label';
66
import Validation from './Validation';
77
import InputField from './InputField';

src/Components/HTML/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ const Markup = ({
66
<head>
77
<title>Brightizen</title>
88
<meta charSet="utf-8" />
9-
<meta name="theme-color" content="#1890ff">
10-
9+
<meta name="theme-color" content="#FF6D00">
1110
${styles}
1211
${pageTitle}
1312
${pageMeta}
1413
${pageLink}
15-
1614
<meta name="description" content="This is the description of the website." />
1715
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
1816
${styles}

src/Components/Header/Brand.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const Brand = ({
1414

1515
const StyledBrand = styled(Image)`
1616
max-width: ${props => (props.width ? 'auto' : '100%')};
17+
display: flex;
1718
`;
1819

1920
Brand.defaultProps = {

src/Components/Header/MainNav.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import React from 'react';
12
import styled from 'styled-components';
2-
import Container from 'src/Components/Container';
3+
import { Container } from 'src/Components/Layout';
34

4-
const MainNav = styled(Container)`
5+
const MainNav = ({ ...rest }) => (
6+
<StyledMainNav as="header" {...rest} />
7+
);
8+
9+
const StyledMainNav = styled(Container)`
510
width: 100%;
611
box-shadow: ${props => props.theme.boxShadows[0]};
712
font-weight: ${props => props.theme.fontWeights[7]};

src/Components/Header/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
55
import logo from 'src/static/images/full-logo.svg';
66

77
import Head from 'src/Components/Head';
8-
import FlexBox from 'src/Components/FlexBox';
8+
import { FlexBox } from 'src/Components/Layout';
99
import MainNav from './MainNav';
1010
import Brand from './Brand';
1111

File renamed without changes.
File renamed without changes.

src/Components/Layout/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import CardBox from './CardBox';
2+
import Container from './Container';
3+
import FlexBox from './FlexBox';
4+
5+
export {
6+
CardBox,
7+
Container,
8+
FlexBox,
9+
};

src/Components/Navigation/Anchor/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import PropTypes from 'prop-types';
4-
import Container from 'src/Components/Container';
4+
import { Container } from 'src/Components/Layout';
55

66
const StyledAnchor = styled.a`
77
cursor: ${props => (props.href ? 'pointer' : 'default')};

src/Components/Navigation/NavLink/index.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 'styled-components';
33
import PropTypes from 'prop-types';
44
import { Link } from 'react-router-dom';
5-
import Container from 'src/Components/Container';
5+
import { Container } from 'src/Components/Layout';
66

77
const StyledLink = styled(Link)`
88
display: ${props => props.display};
File renamed without changes.

src/Components/Typo/Heading/index.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
import styled from 'styled-components';
2-
import { Heading } from 'rebass';
2+
import { Heading as H } from 'rebass';
33

4-
const StyledHeading = styled(Heading)`
4+
const Heading = styled(H)`
55
font-family: ${props => props.theme.fonts.headline};
66
`;
77

8-
StyledHeading.defaultProps = {
8+
Heading.defaultProps = {
99
fontSize: [2, 3, 4],
1010
lineHeight: 'title',
1111
m: 0,
1212
};
1313

14-
const H1 = StyledHeading.withComponent('h1');
15-
const H2 = StyledHeading.withComponent('h2');
16-
const H3 = StyledHeading.withComponent('h3');
17-
18-
export {
19-
H1,
20-
H2,
21-
H3,
22-
};
14+
export default Heading;

src/Components/Typo/Text/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import styled from 'styled-components';
2+
import { Text as T } from 'rebass';
3+
4+
const Text = styled(T)`
5+
font-family: ${props => props.theme.fonts.body};
6+
`;
7+
8+
Text.defaultProps = {
9+
color: 'white',
10+
fontSize: [0, 1, 2],
11+
lineHeight: 'body',
12+
m: 0,
13+
};
14+
15+
export default Text;

src/Components/Typo/TextBlock/index.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/Components/Typo/index.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
1-
import {
2-
H1,
3-
H2,
4-
H3,
5-
} from './Heading';
6-
import {
7-
TextBlock,
8-
P,
9-
Span,
10-
Small,
11-
} from './TextBlock';
1+
import Heading from './Heading';
2+
import Text from './Text';
123

13-
export {
14-
H1,
15-
H2,
16-
H3,
17-
TextBlock,
18-
P,
19-
Span,
20-
Small,
21-
};
4+
export { Heading, Text };

src/Components/Welcome/index.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Pages/404/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import React from 'react';
2-
import { HttpStatus } from 'src/Components/SSR';
2+
import { HttpStatus } from 'src/Components/Route';
33
import Head from 'src/Components/Head';
4-
import Footer from 'src/Components/Footer';
54

65
const NotFound404 = () => (
76
<HttpStatus httpStatus={404}>
87
<Head title="Not found" />
98
<div>
109
<h1>Oops, nothing here!</h1>
1110
</div>
12-
<Footer />
1311
</HttpStatus>
1412
);
1513

0 commit comments

Comments
 (0)