Skip to content

Commit 839c8ed

Browse files
committed
ADD: added old style for primary buttons, added styleguidist stuff and wrappers
1 parent 4f96d53 commit 839c8ed

File tree

10 files changed

+74
-34
lines changed

10 files changed

+74
-34
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"test": "react-scripts test --env=jsdom",
2727
"eject": "react-scripts eject",
2828
"predeploy": "npm run build",
29-
"deploy": "firebase deploy"
29+
"deploy": "firebase deploy",
30+
"styleguide": "npx styleguidist server"
3031
},
3132
"browserslist": [
3233
">0.2%",

src/components/grid/grid.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
space,
1010
gridArea,
1111
display,
12+
gridAutoFlow,
1213
} from 'styled-system';
1314

1415
const Grid = styled.div`
@@ -19,6 +20,7 @@ const Grid = styled.div`
1920
${gridAutoColumns}
2021
${gridTemplateRows}
2122
${gridTemplateColumns}
23+
${gridAutoFlow}
2224
${space}
2325
${gridArea}
2426
${display}

src/components/skillBlock/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```js
2+
<Block variant="primary">Skill</Block>
3+
```

src/components/skillBlock/skillBlock.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import React from 'react';
22
import { Link } from 'react-router-dom';
33
import { Button } from 'rebass';
44

5-
const Block = ({ children, skill = null, active }) => {
5+
const Block = props => {
66
// builds a custom link :sweat-smile:
7-
let name = skill || children;
7+
let name = props.skill || props.children;
88
const link = `/portfolio/${encodeURI(name.toLowerCase().replace(' ', '-'))}`;
99
return (
10-
<Button as={Link} to={link} active={active}>
11-
{children}
10+
<Button as={Link} to={link} {...props}>
11+
{props.children}
1212
</Button>
1313
);
1414
};

src/components/wrapper/wrapper.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import { BrowserRouter as Router } from 'react-router-dom';
3+
import createBrowserHistory from 'history/createBrowserHistory';
4+
import ThemeWrapper from '../../styles/themeWrapper';
5+
6+
const history = createBrowserHistory();
7+
8+
export default ({ children }) => (
9+
<ThemeWrapper>
10+
<Router history={history}>{children}</Router>
11+
</ThemeWrapper>
12+
);

src/index.js

+9-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import { ThemeProvider } from 'styled-components';
4-
import { Router, Route, Switch } from 'react-router-dom';
5-
import createBrowserHistory from 'history/createBrowserHistory';
3+
import { Route, Switch } from 'react-router-dom';
64

75
import Home from './pages/home';
86
import Portfolio from './pages/portfolio';
9-
import theme from './styles/theme';
10-
import GlobalStyles from './styles/globalStyles';
11-
12-
const history = createBrowserHistory();
7+
import Wrapper from './components/wrapper/wrapper';
138

149
function App() {
1510
return (
1611
<div className="App">
17-
<GlobalStyles />
18-
<ThemeProvider theme={theme}>
19-
<Router history={history}>
20-
<Switch>
21-
<Route exact path="/" component={Home} />
22-
<Route exact path="/portfolio" component={Portfolio} />
23-
<Route path="/portfolio/:filter" component={Portfolio} />
24-
</Switch>
25-
</Router>
26-
</ThemeProvider>
12+
<Wrapper>
13+
<Switch>
14+
<Route exact path="/" component={Home} />
15+
<Route exact path="/portfolio" component={Portfolio} />
16+
<Route path="/portfolio/:filter" component={Portfolio} />
17+
</Switch>
18+
</Wrapper>
2719
</div>
2820
);
2921
}

src/pages/home/skills.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import React from 'react';
22
import styled from 'styled-components';
3+
import { Box } from 'rebass';
34
import Block from '../../components/skillBlock/skillBlock';
45
import skillData from '../../static/data/skills.json';
56

67
export default () => {
8+
// TODO: Change skills mapping to a reducer
9+
// BODY: It can be a reducer or a for loop. So that we don't need to loop them 2 times on each render
710
const programming_skills = skillData.filter(
811
skill => skill.type === 'Programming',
912
);
@@ -13,29 +16,29 @@ export default () => {
1316
<h2>Expertise</h2>
1417
<Group>
1518
<h3>Programming</h3>
16-
<List>
19+
{/* TODO: move skill lists to separate file */}
20+
<Box flex>
1721
{programming_skills.map(skill => (
18-
<Block key={skill.name}>{skill.name}</Block>
22+
<Block mr="3" mb="3" variant="primary" key={skill.name}>
23+
{skill.name}
24+
</Block>
1925
))}
20-
</List>
26+
</Box>
2127
</Group>
2228
<Group>
2329
<h3>Design</h3>
24-
<List>
30+
<Box>
2531
{design_skills.map(skill => (
26-
<Block key={skill.name}>{skill.name}</Block>
32+
<Block mr="3" mb="3" variant="primary" key={skill.name}>
33+
{skill.name}
34+
</Block>
2735
))}
28-
</List>
36+
</Box>
2937
</Group>
3038
</div>
3139
);
3240
};
3341

34-
const List = styled.div`
35-
display: flex;
36-
flex-wrap: wrap;
37-
`;
38-
3942
const Group = styled.div`
4043
margin-bottom: 1em;
4144
`;

src/styles/theme.js

+14
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,22 @@ const theme = {
4848
space: [0, 4, 8, 16, 32, 64, 128, 256],
4949
buttons: {
5050
primary: {
51+
display: 'inline-block',
52+
padding: '0.5em 1em',
53+
width: 'max-content',
54+
border: 'medium none',
55+
outline: 'currentcolor none medium',
56+
transition: 'all 0.1s ease 0s',
57+
cursor: 'pointer',
58+
boxShadow: `${color.secondary} 4px 4px 0px 0px`,
59+
borderRadius: 0,
5160
color: color.text,
5261
backgroundColor: color.primary,
62+
'&:hover, &:active': {
63+
boxShadow: 'rgb(96, 76, 141) 4px 4px 0px 0px',
64+
backgroundColor: 'rgb(106, 217, 121)',
65+
transform: 'scale(1.2)',
66+
},
5367
},
5468
outline: {
5569
color: color.primary,

src/styles/themeWrapper.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import theme from './theme';
3+
import GlobalStyles from './globalStyles';
4+
import { ThemeProvider } from 'styled-components';
5+
6+
export default ({ children }) => (
7+
<ThemeProvider theme={theme}>
8+
<React.Fragment>
9+
<GlobalStyles />
10+
{children}
11+
</React.Fragment>
12+
</ThemeProvider>
13+
);

styleguide.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22

33
module.exports = {
44
styleguideComponents: {
5-
Wrapper: path.join(__dirname, 'src/styleguidist/wrapper'),
5+
Wrapper: path.join(__dirname, 'src/components/wrapper/wrapper'),
66
},
77
skipComponentsWithoutExample: true,
88
};

0 commit comments

Comments
 (0)