Commit 0699ec66f00b3582d31fe6e4bb8bd34beacb7d63
Creating header and navbar
Rômulo Alves committed on 10/27/2016, 9:57:32 AMParent: 6b5b84b3614cf087b2199be76f9d915b13d8ae89
Files changed
_components/common/Head.js | changed |
_components/common/globalStyles.js | changed |
_components/common/Anchor.js | added |
_components/index/Header.js | changed |
_components/index/NavBar.js | added |
pages/index.js | changed |
_components/common/Head.js | ||
---|---|---|
@@ -13,8 +13,9 @@ | ||
13 | 13 | |
14 | 14 | export default ({title}) => ( |
15 | 15 | <div> |
16 | 16 | <Head> |
17 | + <meta charSet="utf-8" /> | |
17 | 18 | <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> |
18 | 19 | <meta name="description" content="@romuloalves - Web Developer" /> |
19 | 20 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
20 | 21 | <link rel="icon" type="image/png" href="/static/favicon.png" /> |
_components/common/globalStyles.js | ||
---|---|---|
@@ -4,7 +4,8 @@ | ||
4 | 4 | margin: 0; |
5 | 5 | padding: 0; |
6 | 6 | } |
7 | 7 | body { |
8 | + font-family: Menlo, Monaco, Consolas; | |
8 | 9 | min-height: 100%; |
9 | 10 | } |
10 | 11 | `; |
_components/common/Anchor.js | ||
---|---|---|
@@ -1,0 +1,24 @@ | ||
1 | +// Packages | |
2 | +import React from 'react'; | |
3 | +import css from 'next/css'; | |
4 | + | |
5 | +const generateClassNames = (styleOne, styleTwo) => { | |
6 | + if (styleTwo !== null && styleTwo !== undefined) { | |
7 | + return `${styleOne} ${styleTwo}`; | |
8 | + } | |
9 | + return styleOne; | |
10 | +}; | |
11 | + | |
12 | +export default ({href, title, children, color, hoverColor, fontSize, className}) => { | |
13 | + const style = css({ | |
14 | + color: color || '#000', | |
15 | + fontSize: fontSize || '10pt', | |
16 | + ':hover': { | |
17 | + color: hoverColor || '#81D4FA' | |
18 | + } | |
19 | + }); | |
20 | + const classNames = generateClassNames(style, className); | |
21 | + return ( | |
22 | + <a href={href} title={title} className={classNames} target="_blank">{children}</a> | |
23 | + ); | |
24 | +}; |
_components/index/Header.js | ||
---|---|---|
@@ -1,16 +1,33 @@ | ||
1 | 1 | // Packages |
2 | 2 | import React from 'react'; |
3 | 3 | import css from 'next/css'; |
4 | 4 | |
5 | +// Components | |
6 | +import Anchor from '../common/Anchor'; | |
7 | + | |
5 | 8 | export default () => ( |
6 | 9 | <header className={headerStyle}> |
7 | - <h1>Rômulo Alves</h1> | |
10 | + <h1 className={titleStyle}>Rômulo Alves</h1> | |
11 | + <h2 className={subtitleStyle}> | |
12 | + Web Developer at <Anchor href="https://www.cwi.com.br/" title="CWI Software" color="#FFF">@cwisoftware</Anchor> | |
13 | + </h2> | |
8 | 14 | </header> |
9 | 15 | ); |
10 | 16 | |
11 | 17 | const headerStyle = css({ |
12 | 18 | background: '#EF5350', |
13 | - minHeight: '50%', | |
14 | - top: 0, | |
15 | - width: '100%' | |
19 | + color: '#FFF', | |
20 | + left: 0, | |
21 | + padding: '50px 0', | |
22 | + right: 0, | |
23 | + textAlign: 'center', | |
24 | + top: 0 | |
16 | 25 | }); |
26 | + | |
27 | +const titleStyle = css({ | |
28 | + fontSize: '25pt' | |
29 | +}); | |
30 | + | |
31 | +const subtitleStyle = css({ | |
32 | + fontSize: '12pt' | |
33 | +}); |
_components/index/NavBar.js | ||
---|---|---|
@@ -1,0 +1,72 @@ | ||
1 | +// Packages | |
2 | +import React from 'react'; | |
3 | +import css from 'next/css'; | |
4 | + | |
5 | +// Components | |
6 | +import Anchor from '../common/Anchor'; | |
7 | + | |
8 | +export default () => ( | |
9 | + <nav className={navbarStyle}> | |
10 | + <ul className={listStyle}> | |
11 | + <li className={`${listItemStyle} ${noMarginLeft}`}> | |
12 | + <Anchor href="https://twitter.com/romuloalves" title="twitter"> | |
13 | ||
14 | + </Anchor> | |
15 | + </li> | |
16 | + <li className={listItemStyle}> | |
17 | + <Anchor href="https://github.com/romuloalves" title="github"> | |
18 | + GitHub | |
19 | + </Anchor> | |
20 | + </li> | |
21 | + <li className={listItemStyle}> | |
22 | + <Anchor href="mailto:romuloaalv@gmail.com" title="e-mail"> | |
23 | ||
24 | + </Anchor> | |
25 | + </li> | |
26 | + <li className={`${listItemStyle} ${noMarginRight}`}> | |
27 | + <Anchor href="https://medium.com/@romuloalves" title="medium"> | |
28 | + Medium | |
29 | + </Anchor> | |
30 | + </li> | |
31 | + </ul> | |
32 | + </nav> | |
33 | +); | |
34 | + | |
35 | +const navbarStyle = css({ | |
36 | + margin: '0 auto', | |
37 | + padding: '30px 0', | |
38 | + width: '420px', | |
39 | + '@media (max-width: 500px)': { | |
40 | + width: '300px' | |
41 | + }, | |
42 | + '@media (max-width: 300px)': { | |
43 | + width: 'auto' | |
44 | + } | |
45 | +}); | |
46 | + | |
47 | +const listStyle = css({ | |
48 | + overflow: 'auto' | |
49 | +}); | |
50 | + | |
51 | +const listItemStyle = css({ | |
52 | + float: 'left', | |
53 | + listStyleType: 'none', | |
54 | + margin: '0 30px', | |
55 | + textAlign: 'center', | |
56 | + width: '60px', | |
57 | + '@media (max-width: 500px)': { | |
58 | + margin: '0 10px' | |
59 | + }, | |
60 | + '@media (max-width: 300px)': { | |
61 | + margin: '15px 0', | |
62 | + width: '100%' | |
63 | + } | |
64 | +}); | |
65 | + | |
66 | +const noMarginRight = css({ | |
67 | + marginRight: '0' | |
68 | +}); | |
69 | + | |
70 | +const noMarginLeft = css({ | |
71 | + marginLeft: '0' | |
72 | +}); |
Built with git-ssb-web