mirror of
https://github.com/ascribe/onion.git
synced 2025-01-26 17:51:04 +01:00
Move styleguide to actual app
This commit is contained in:
parent
50eeafba16
commit
24d5275c1a
27
js/lib/buttons.js
Normal file
27
js/lib/buttons.js
Normal file
@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import _Button from 'react-bootstrap/lib/Button';
|
||||
|
||||
export const Button = React.createClass({
|
||||
|
||||
render: function render() {
|
||||
return (
|
||||
<_Button>
|
||||
{this.props.children}
|
||||
</_Button>
|
||||
)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
export const SecondaryButton = React.createClass({
|
||||
|
||||
render: function render() {
|
||||
return (
|
||||
<_Button className='btn-secondary'>
|
||||
{this.props.children}
|
||||
</_Button>
|
||||
)
|
||||
}
|
||||
|
||||
});
|
13
js/routes.js
13
js/routes.js
@ -31,6 +31,18 @@ let Redirect = Router.Redirect;
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
|
||||
function getDebugRoutes() {
|
||||
let StyleGuideContainer = require('./styleguide/container.js');
|
||||
if (window.DEBUG) {
|
||||
return (
|
||||
<Route name="styleguide" path="styleguide" handler={StyleGuideContainer} headerTitle="Style Guide" />
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const COMMON_ROUTES = (
|
||||
<Route name="app" path={baseUrl} handler={App}>
|
||||
<Redirect from={baseUrl} to="login" />
|
||||
@ -46,6 +58,7 @@ const COMMON_ROUTES = (
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||
<Route name="prizes" path="prizes" handler={PrizesDashboard} />
|
||||
{getDebugRoutes()}
|
||||
</Route>
|
||||
);
|
||||
|
||||
|
47
js/styleguide/components/buttons.js
Normal file
47
js/styleguide/components/buttons.js
Normal file
@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { Button, SecondaryButton } from '../../lib/buttons';
|
||||
import Panel from 'react-bootstrap/lib/Panel';
|
||||
|
||||
|
||||
let Buttons = React.createClass({
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h2>Button</h2>
|
||||
<p><code>import { Button } from './js/lib/buttons';</code></p>
|
||||
<Panel header='example'>
|
||||
<div>
|
||||
<p>This is a paragraph with
|
||||
<Button>
|
||||
{"a button"}
|
||||
</Button>
|
||||
that should be displayed inline
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>This is a form with a large submit button
|
||||
<form className="ascribe-form-bordered">
|
||||
<Button>
|
||||
{"an inline button"}
|
||||
</Button>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<div>
|
||||
<SecondaryButton>
|
||||
{"<SecondaryButton>"}
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default Buttons;
|
20
js/styleguide/container.js
Normal file
20
js/styleguide/container.js
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Buttons from './components/buttons';
|
||||
|
||||
|
||||
let StyleGuideContainer = React.createClass({
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<Buttons />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
export default StyleGuideContainer;
|
@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Buttons from './components/buttons';
|
||||
import Panel from 'react-bootstrap/lib/Panel';
|
||||
|
||||
|
||||
React.render(
|
||||
<div className="container">
|
||||
<h3>Buttons</h3>
|
||||
<Buttons />
|
||||
</div>,
|
||||
document.getElementById('main')
|
||||
);
|
@ -1,30 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
let Buttons = React.createClass({
|
||||
render() {
|
||||
let classes = [
|
||||
'btn btn-default',
|
||||
'btn ascribe-btn',
|
||||
'btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner',
|
||||
'btn btn-danger btn-delete btn-sm'
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
{classes.map((c) => {
|
||||
return (
|
||||
<span className={c}>
|
||||
{c}
|
||||
</span>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default Buttons;
|
Loading…
Reference in New Issue
Block a user