Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Theme picker #73

Merged
merged 3 commits into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
import React from 'react';
import infoAddon from '@kadira/react-storybook-addon-info';
import { Container } from '../src';
import { Button,ButtonGroup, Container } from '../src';
import { configure, setAddon, addDecorator } from '@kadira/storybook';

const ThemeLink = props => {
const changeTheme = url => {
const link = document.getElementById('theme');
link.href = url;
}

return <Button color="link" onClick={() => changeTheme(props.url)}>{props.children}</Button>
}

const THEMES = [
{ name: 'APM/Saffron', url: 'https://s3-us-west-2.amazonaws.com/appfolio-frontend-dev/styles/bootstrap.css' },
{ name: 'Bootstrap', url: 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css' },
{ name: 'Admire', url: 'http://dev.lorvent.com/admire/css/components.css' },
{ name: 'Paper', url: 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/paper/bootstrap.min.css' },
{ name: 'Superhero', url: 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/superhero/bootstrap.min.css' },
];

addDecorator((story, info) => (
<div>
<ButtonGroup size="sm">
{THEMES.map(theme => <ThemeLink url={theme.url}>{theme.name}</ThemeLink>)}
</ButtonGroup>
<Container fluid className="m-5">
<header className="mb-5">
<h1 className="display-4 mb-3">{info.kind}</h1>
Expand All @@ -13,6 +34,7 @@ addDecorator((story, info) => (
{story()}
</section>
</Container>
</div>
));

setAddon(infoAddon);
Expand Down
2 changes: 1 addition & 1 deletion .storybook/head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<link rel="stylesheet" href="https://s3-us-west-2.amazonaws.com/appfolio-frontend-dev/styles/bootstrap.css">
<link id="theme" rel="stylesheet" href="https://s3-us-west-2.amazonaws.com/appfolio-frontend-dev/styles/bootstrap.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">