Skip to content

Commit

Permalink
Enable Bloom style guide
Browse files Browse the repository at this point in the history
- Upgrade to react-router-dom@v4.2.2
- Add OffCanvasPanel styleguide component
- Update styleguide with some basic screens
  • Loading branch information
Richard Palmer committed Sep 12, 2017
1 parent 72843c3 commit 024c453
Show file tree
Hide file tree
Showing 28 changed files with 668 additions and 66 deletions.
6 changes: 3 additions & 3 deletions components/Badge/Badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
padding-bottom: var(--size-micro);
padding-left: var(--size-small);
padding-right: var(--size-small);
background-color: var(--color-greyLighter);
background-color: var(--color-greyLightest);
color: var(--color-grey);
border: 1px solid var(--color-greyLighter);
border: 1px solid var(--color-greyLightest);
composes: fontSmallIi from '../../globals/typography.css';
text-transform: uppercase;
font-weight: var(--fontweight-demi);
Expand Down Expand Up @@ -38,4 +38,4 @@
.hollow.special {
color: var(--color-black);
border-color: currentColor;
}
}
3 changes: 2 additions & 1 deletion components/Icon/Icon.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
.chatting svg,
.comment svg,
.clock svg,
.cross svg,
.dollar svg,
.download svg,
.globe svg,
Expand Down Expand Up @@ -43,10 +42,12 @@
.card-list svg,
.chevron svg,
.chevron-right svg,
.cross svg,
.facebook svg,
.filter svg,
.heart svg,
.map svg,
.menu svg,
.minus svg,
.pintrest svg,
.plus svg,
Expand Down
2 changes: 2 additions & 0 deletions components/Icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import heart from './icons/icon-heart.svg';
import location from './icons/icon-location.svg';
import manage from './icons/icon-manage.svg';
import map from './icons/icon-map.svg';
import menu from './icons/icon-menu.svg';
import minus from './icons/icon-minus.svg';
import notification from './icons/icon-notification.svg';
import percentage from './icons/icon-percentage.svg';
Expand Down Expand Up @@ -82,6 +83,7 @@ export default {
location: svgClean(location),
manage: svgClean(manage),
map: svgClean(map),
menu,
minus: svgClean(minus),
notification: svgClean(notification),
percentage: svgClean(percentage),
Expand Down
13 changes: 12 additions & 1 deletion components/Icon/icons/icon-cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions components/Icon/icons/icon-menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
componentSrc: resolveApp('components'),
utilsSrc: resolveApp('utils'),
globalsSrc: resolveApp('globals'),
constantsSrc: resolveApp('constants'),
testsSetup: resolveApp('styleguide/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
ownNodeModules: resolveApp('node_modules'),
Expand Down
2 changes: 1 addition & 1 deletion config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = {
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
include: [paths.appSrc, paths.componentSrc, paths.utilsSrc],
include: [paths.appSrc, paths.componentSrc, paths.utilsSrc, paths.constantsSrc],
loader: 'babel',
query: require('./babel.dev')
},
Expand Down
4 changes: 2 additions & 2 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = {
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
include: [paths.appSrc, paths.componentSrc, paths.utilsSrc],
include: [paths.appSrc, paths.componentSrc, paths.utilsSrc, paths.constantsSrc],
loader: 'babel',
query: require('./babel.prod')
},
Expand Down Expand Up @@ -268,6 +268,6 @@ module.exports = {
}
}),
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
new ExtractTextPlugin('/static/css/[name].[contenthash:8].css')
new ExtractTextPlugin('static/css/[name].[contenthash:8].css')
]
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"react-motion": "^0.4.7",
"react-on-visible": "^1.0.3",
"react-portal": "^3.0.0",
"react-router": "next",
"react-router-dom": "^4.2.2",
"react-stickynode": "^1.2.1",
"subscribe-ui-event": "^1.0.14",
"warning": "^3.0.0"
Expand Down
5 changes: 0 additions & 5 deletions styleguide/Example.js

This file was deleted.

57 changes: 57 additions & 0 deletions styleguide/Styleguide.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.root {
position: relative;
}

.navigationSm {
padding-top: var(--size-lg-ii);
padding-bottom: var(--size-lg-i);
}

.navigationLg {
display: none;
}

.body {
padding-top: calc(3 * var(--size-regular));
padding-left: var(--size-regular);
padding-right: var(--size-regular);
width: 100%;
}

.menuBtn {
position: absolute;
top: 0;
left: 0;
padding: var(--size-regular);
color: var(--color-greyDarker);
}

@media(min-width: 56.25rem) {
.root {
display: flex;
}

.menuBtn {
display: none;
}

.navigationSm {
display: none;
}

.navigationLg {
display: block;
padding-top: var(--size-lg-ii);
padding-left: var(--size-lg-i);
padding-right: var(--size-lg-i);
transform: translate3d(0, 0, 0);
flex-basis: 30%;
position: relative;
}

.body {
flex-basis: 70%;
margin-top: 0;
padding: var(--size-lg-ii);
}
}
103 changes: 79 additions & 24 deletions styleguide/Styleguide.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,82 @@
import React from 'react';
import { BrowserRouter, Match, Miss, Link } from 'react-router';
import React, { Component } from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';

import SiteHeader from './components/SiteHeader/SiteHeader';
import Navigation from './components/Navigation/Navigation';
import OffCanvasPanel from './components/OffCanvasPanel/OffCanvasPanel';

import BtnContainer from '../components/BtnContainer/BtnContainer';
import Icon from '../components/Icon/Icon';
import ScreenReadable from '../components/ScreenReadable/ScreenReadable';

/* Pages */
import Introduction from './screens/Overview/Introduction';
import Goals from './screens/Overview/Goals';
import Faq from './screens/Overview/Faq';

import Introduction from './Introduction';
import Example from './Example';
import FourOhFour from './404';

export default () => (
<BrowserRouter>
<div>
<nav>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/example">Example</Link></li>
</ul>
</nav>
<div>
<h1>Bloom</h1>
<p>v{ `${process.env.npm_package_version}` }</p>
<Match exactly pattern="/" component={ Introduction } />
<Match pattern="/example" component={ Example } />

<Miss component={ FourOhFour } />
</div>
</div>
</BrowserRouter>
);
import css from './Styleguide.css';

export default class Styleguide extends Component {
state = {
showNavigation: true,
};

toggleNavigation = () => {
this.setState(({ showNavigation }) => ({
showNavigation: !showNavigation,
}));
};

openNavigation = () => {
this.setState({ showNavigation: true });
};

closeNavigation = () => {
this.setState({ showNavigation: false });
};

render() {
const { showNavigation } = this.state;

return (
<BrowserRouter>
<div className={ css.root }>
<BtnContainer className={ css.menuBtn } onClick={ this.openNavigation }>
<Icon className={ css.menuIcon } name="menu" />
<ScreenReadable>Open menu</ScreenReadable>
</BtnContainer>
<OffCanvasPanel
className={ css.navigationSm }
activeClassName={ css.navigationActive }
active={ showNavigation }
onClose={ this.closeNavigation }
>
<SiteHeader
version={ process.env.npm_package_version }
onLinkClick={ this.closeMenu }
/>
<Navigation onLinkClick={ this.closeNavigation } />
</OffCanvasPanel>
<div className={ css.navigationLg }>
<SiteHeader
version={ process.env.npm_package_version }
onLinkClick={ this.closeMenu }
/>
<Navigation onLinkClick={ this.closeNavigation } />
</div>
<div className={ css.body }>
<Switch>
<Route exact path="/" component={ Introduction } />
<Route path="/goals" component={ Goals } />
<Route path="/faq" component={ Faq } />

<Route component={ FourOhFour } />
</Switch>
</div>
</div>
</BrowserRouter>
);
}
}
42 changes: 42 additions & 0 deletions styleguide/components/Navigation/Navigation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.section + .section {
margin-top: var(--size-lg-ii);
}

.title {
composes: fontLargeI from '../../../globals/typography.css';
color: var(--color-greyDarkest);
padding-left: var(--size-lg-i);
padding-right: var(--size-lg-i);
}

.linkList {
list-style-type: none;
margin-top: var(--size-sm-i);
margin-left: 0;
margin-left: 0;
margin-bottom: 0;
padding: 0;
}

.link {
display: block;
composes: fontRegular from '../../../globals/typography.css';
color: var(--color-greyDark);
padding-top: var(--size-sm-iii);
padding-bottom: var(--size-sm-iii);
padding-left: var(--size-lg-ii);
padding-right: var(--size-lg-ii);
text-decoration: none;
}

.link:hover {
color: var(--color-grey);
}

.linkActive {
font-weight: var(--fontweight-demi);
}

.linkListItem + .linkListItem .link {
margin-top: var(--size-sm-ii);
}
Loading

0 comments on commit 024c453

Please sign in to comment.