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 components #26

Merged
merged 2 commits into from
Oct 26, 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
20 changes: 20 additions & 0 deletions src/components/BlockPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { Card, CardBlock } from 'reactstrap';

const BlockPanel = (props) => (
<Card className="bg-faded">
<CardBlock>
{props.url ? <a href={props.url} className="pull-right">edit</a> : null}
{props.title ? <h6><strong>{props.title}</strong></h6> : null}
{props.children || props.value}
</CardBlock>
</Card>
);

BlockPanel.PropTypes = {
title: React.PropTypes.string,
url: React.PropTypes.string,
value: React.PropTypes.string
};

export default BlockPanel;
12 changes: 12 additions & 0 deletions src/components/Flag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { Tag } from 'reactstrap';

const Flag = (props) => (
<Tag color={props.color}>{props.children}</Tag>
);

Flag.PropTypes = {
color: React.PropTypes.string
};

export default Flag;
23 changes: 23 additions & 0 deletions src/components/Icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import FontAwesome from 'react-fontawesome';

const Icon = (props) => (
<FontAwesome {...props} />
);

Icon.PropTypes = {
border: React.PropTypes.bool,
className: React.PropTypes.string,
cssModule: React.PropTypes.object,
fixedWidth: React.PropTypes.bool,
flip: React.PropTypes.oneOf(['horizontal', 'vertical']),
inverse: React.PropTypes.bool,
name: React.PropTypes.string.isRequired,
pulse: React.PropTypes.bool,
rotate: React.PropTypes.oneOf([90, 180, 270]),
size: React.PropTypes.oneOf(['lg', '2x', '3x', '4x', '5x']),
spin: React.PropTypes.bool,
stack: React.PropTypes.oneOf(['1x', '2x'])
};

export default Icon;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import FormRow from './components/FormRow.js';
import HelpBubble from './components/HelpBubble.js';
//import Icon from './components/Icon.js';
import PatternInput from './components/PatternInput.js';
import UnitPropertyCard from './components/UnitPropertyCard.js';
//import UnitPropertyCard from './components/UnitPropertyCard.js';

export * from 'reactstrap';

Expand All @@ -31,5 +31,5 @@ export {
HelpBubble,
FontAwesome as Icon,
PatternInput,
UnitPropertyCard
// UnitPropertyCard TODO
};
69 changes: 48 additions & 21 deletions stories/Alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,67 @@ import React from 'react';
import { Button, Container } from 'reactstrap';
import { storiesOf } from '@kadira/storybook';

import Alert from '../src/components/Alert';
import { Alert } from '../src/index';

storiesOf('Alerts', module)
.add('Colors', () => (
<Container className="m-t-1">
.addWithInfo('Colors', () => (
<div>
<Alert>
<p>The default alert is a "warning". It supports any sort of custom markup.</p>
<p className="m-b-0"><Button>Like This!</Button></p>
</Alert>
<Alert color="success">You can specify an alert color. This one has <code>color="success"</code></Alert>
<Alert color="success">
You can specify an alert color. This one has <code>color="success"</code>
</Alert>
<Alert color="danger">This one looks dangerous!</Alert>
<Alert color="info"><strong>Heads up!</strong> This alert needs your attention, but it's not super important.</Alert>
</Container>
<Alert color="info">
<strong>Heads up!</strong> This alert needs your attention, but it's not super important.
</Alert>
</div>
))
.add('Icons', () => (
<Container className="m-t-1">
.addWithInfo('Icons', () => (
<div>
<Alert icon>You can also add an icon!</Alert>
<Alert icon color="success">You can specify an alert color. This one has <code>color="success"</code></Alert>
<Alert icon color="danger"><p className="m-b-0">Humblebrag prism twee, gochujang seitan whatever asymmetrical ramps enamel pin austin salvia swag helvetica. Chartreuse food truck tofu raclette, 3 wolf moon poke chia paleo skateboard. Pickled tote bag echo park raclette. Irony fashion axe sartorial, cornhole jean shorts vaporware flannel salvia glossier beard 3 wolf moon. Literally semiotics hammock irony cred, bicycle rights lomo selvage tousled vegan 8-bit. Four loko cardigan live-edge truffaut pour-over, helvetica chia brooklyn swag pug scenester kogi pitchfork leggings yuccie. Ethical put a bird on it portland vape YOLO.</p></Alert>
<Alert icon color="info"><strong>Heads up!</strong> This alert needs your attention, but it's not super important.</Alert>
</Container>
<Alert icon color="success">
You can specify an alert color. This one has <code>color="success"</code>
</Alert>
<Alert icon color="danger">
<p className="m-b-0">
Humblebrag prism twee, gochujang seitan whatever asymmetrical ramps enamel pin austin
salvia swag helvetica. Chartreuse food truck tofu raclette, 3 wolf moon poke chia paleo
skateboard. Pickled tote bag echo park raclette. Irony fashion axe sartorial, cornhole
jean shorts vaporware flannel salvia glossier beard 3 wolf moon. Literally semiotics
hammock irony cred, bicycle rights lomo selvage tousled vegan 8-bit. Four loko cardigan
live-edge truffaut pour-over, helvetica chia brooklyn swag pug scenester kogi pitchfork
leggings yuccie. Ethical put a bird on it portland vape YOLO.
</p>
</Alert>
<Alert icon color="info">
<strong>Heads up!</strong> This alert needs your attention, but it's not super important.
</Alert>
</div>
))
.add('Dismissible', () => (
<Container className="m-t-1">
<Alert dismissible icon color="success">Alerts can also be dismissed. Simply add the <code>dismissible</code> prop.</Alert>
</Container>
.addWithInfo('Dismissible', () => (
<div>
<Alert dismissible icon color="success">
Alerts can also be dismissed. Simply add the <code>dismissible</code> prop.
</Alert>
</div>
))
.add('Bootstrap Extras', () => (
<Container className="m-t-1">
.addWithInfo('Bootstrap Extras', () => (
<div>
<Alert icon color="info">
<h4 className="alert-heading">Well done!</h4>
<p>You can use the <code>alert-heading</code> class on a heading to make it stand out!</p>
<p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
<p className="m-b-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
<p>
Aww yeah, you successfully read this important alert message.
This example text is going to run a bit longer so that you can see how spacing within
an alert works with this kind of content.
</p>
<p className="m-b-0">
Whenever you need to, be sure to use margin utilities to keep things
nice and tidy.
</p>
</Alert>
</Container>
</div>
));
12 changes: 12 additions & 0 deletions stories/BlockPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { storiesOf } from '@kadira/storybook';

import { BlockPanel } from '../src';

storiesOf('BlockPanel', module)
.addWithInfo('with props', () => (
<BlockPanel title="Some simple content would go here" url="http://www.google.com">
Hello.
</BlockPanel>
));

100 changes: 42 additions & 58 deletions stories/Buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,55 @@ import { Button, ButtonGroup, ButtonToolbar, Container, ButtonDropdown,
import { storiesOf } from '@kadira/storybook';

storiesOf('Buttons', module)
.add('Colors', () => (
<Container>
<Row className="m-b-1">
<ButtonToolbar>
<Button>Default</Button>
<Button color="primary">Primary</Button>
<Button color="secondary">Secondary</Button>
<Button color="success">Success</Button>
<Button color="info">Info</Button>
<Button color="warning">Warning</Button>
<Button color="danger">Danger</Button>
<Button color="link">Link</Button>
</ButtonToolbar>
</Row>
</Container>
.addWithInfo('Colors', () => (
<ButtonToolbar>
<Button>Default</Button>
<Button color="primary">Primary</Button>
<Button color="secondary">Secondary</Button>
<Button color="success">Success</Button>
<Button color="info">Info</Button>
<Button color="warning">Warning</Button>
<Button color="danger">Danger</Button>
<Button color="link">Link</Button>
</ButtonToolbar>
)
)
.add('Disabled', () => (
<Container>
<Row className="m-b-1">
<ButtonToolbar>
<Button>Default</Button>
<Button disabled color="primary">Primary</Button>
<Button disabled color="secondary">Secondary</Button>
<Button disabled color="success">Success</Button>
<Button disabled color="info">Info</Button>
<Button disabled color="warning">Warning</Button>
<Button disabled color="danger">Danger</Button>
<Button disabled color="link">Link</Button>
</ButtonToolbar>
</Row>
</Container>
.addWithInfo('Disabled', () => (
<ButtonToolbar>
<Button disabled>Default</Button>
<Button disabled color="primary">Primary</Button>
<Button disabled color="secondary">Secondary</Button>
<Button disabled color="success">Success</Button>
<Button disabled color="info">Info</Button>
<Button disabled color="warning">Warning</Button>
<Button disabled color="danger">Danger</Button>
<Button disabled color="link">Link</Button>
</ButtonToolbar>
)
)
.add('Outline', () => (
<Container>
<Row className="m-b-1">
<ButtonToolbar>
<Button>Default</Button>
<Button outline color="primary">Primary</Button>
<Button outline color="secondary">Secondary</Button>
<Button outline color="success">Success</Button>
<Button outline color="info">Info</Button>
<Button outline color="warning">Warning</Button>
<Button outline color="danger">Danger</Button>
<Button outline color="link">Link</Button>
</ButtonToolbar>
</Row>
</Container>
.addWithInfo('Outline', () => (
<ButtonToolbar>
<Button outline>Default</Button>
<Button outline color="primary">Primary</Button>
<Button outline color="secondary">Secondary</Button>
<Button outline color="success">Success</Button>
<Button outline color="info">Info</Button>
<Button outline color="warning">Warning</Button>
<Button outline color="danger">Danger</Button>
<Button outline color="link">Link</Button>
</ButtonToolbar>
)
)
.add('Sizes', () => (
<Container>
<Row className="m-b-1">
<ButtonToolbar>
<Button color="primary" size="lg">Large button</Button>
<Button color="primary" size="md">Medium button</Button>
<Button color="primary" size="sm">Small button</Button>
</ButtonToolbar>
</Row>
</Container>
.addWithInfo('Sizes', () => (
<ButtonToolbar>
<Button color="primary" size="lg">Large button</Button>
<Button color="primary" size="md">Medium button</Button>
<Button color="primary" size="sm">Small button</Button>
</ButtonToolbar>
)
)
.add('Groups', () => (
<Container>
.addWithInfo('Groups', () => (
<div>
<Row className="m-b-1">
<Button size="lg" block>Block level button</Button>
</Row>
Expand Down Expand Up @@ -119,6 +103,6 @@ storiesOf('Buttons', module)
<Button>Button</Button>
</ButtonGroup>
</Row>
</Container>
</div>
)
);
41 changes: 21 additions & 20 deletions stories/Datapair.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@ import React from 'react';
import { Button, Card, CardBlock, Container } from 'reactstrap';
import { storiesOf } from '@kadira/storybook';

import Datapair from '../src/components/Datapair';
import { Datapair } from '../src';

storiesOf('Datapair', module)
.add('with props', () => (
<Container>
<Card className="m-t-1">
<CardBlock>
<Datapair label="Key" value="Some simple content would go here" />
<Datapair label="Another Key" value="More content" />
</CardBlock>
</Card>
</Container>
))
.add('with HTML value', () => (
<Container>
<Card className="m-t-1">
<CardBlock>
<Datapair label="Label">Custom markup <Button color="primary">can go here</Button></Datapair>
<Datapair label="This is a really long label that probably shouldn't be this long" value="Stuff"/>
</CardBlock>
</Card>
</Container>
.addWithInfo('with props', () => (
<Card className="m-t-1">
<CardBlock>
<Datapair label="Key" value="Some simple content would go here" />
<Datapair label="Another Key" value="More content" />
</CardBlock>
</Card>
))
.addWithInfo('with HTML value', () => (
<Card className="m-t-1">
<CardBlock>
<Datapair label="Label">
Custom markup <Button color="primary">can go here</Button>
</Datapair>
<Datapair
label="This is a really long label that probably shouldn't be this long"
value="Stuff"
/>
</CardBlock>
</Card>
));
27 changes: 3 additions & 24 deletions stories/DateMonth.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
import React from 'react';
import { Col, Container, Row } from 'reactstrap';
import { storiesOf } from '@kadira/storybook';

import DateMonth from '../src/components/datemonth/DateMonth';
import { DateMonth } from '../src';

storiesOf('DateMonth', module)
.add('with props', () => (
<Container>
<Row className="flex-items-xs-center">
<Col sm="3">
<DateMonth value="Nov 1979" />
</Col>
</Row>
<h4>Example:</h4>
<pre>{`<DateMonth value="Nov 1979" />`}</pre>
</Container>
))
.add('with invalid props', () => (
<Container>
<Row className="flex-items-xs-center">
<Col sm="3">
<DateMonth value="some bad input" />
</Col>
</Row>
<h4>Example:</h4>
<pre>{`<DateMonth value="some bad input" />`}</pre>
</Container>
));
.addWithInfo('with props', () => <DateMonth value="Nov 1979" />)
.addWithInfo('with invalid props', () => <DateMonth value="some bad input" />);
17 changes: 17 additions & 0 deletions stories/Flag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { storiesOf } from '@kadira/storybook';

import { Flag } from '../src';

storiesOf('Flag', module)
.addWithInfo('with props', () => (
<div>
<Flag>default</Flag>
<Flag color="primary">primary</Flag>
<Flag color="success">success</Flag>
<Flag color="info">info</Flag>
<Flag color="warning">warning</Flag>
<Flag color="danger">danger</Flag>
</div>
));

Loading