1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/component/common/index.js

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-12-09 22:11:05 +01:00
const React = require('react');
const {
List, ListItem, ListItemContent,
Grid, Cell,
Button, Icon,
2016-12-10 12:21:27 +01:00
Switch,
} = require('react-mdl');
2016-12-09 22:11:05 +01:00
const { Link } = require('react-router');
export const AppsLinkList = ({ apps }) => (
<List style={{ textAlign: 'left' }}>
{apps.length > 0 && apps.map(({ appName, description = '-', icon = 'apps' }) => (
<ListItem twoLine key={appName}>
<ListItemContent avatar={icon} subtitle={description}>
<Link key={appName} to={`/applications/${appName}`}>
{appName}
</Link>
</ListItemContent>
</ListItem>
))}
</List>
);
export const HeaderTitle = ({ title, actions, subtitle }) => (
2016-12-10 12:21:27 +01:00
<div style={{ display: 'flex', borderBottom: '1px solid #f1f1f1', marginBottom: '10px', padding: '16px 20px ' }}>
<div style={{ flex: '1' }}>
<h6 style={{ margin: 0 }}>{title}</h6>
{subtitle && <small>{subtitle}</small>}
</div>
<div style={{ flex: '1', textAlign: 'right' }}>
{actions}
</div>
</div>
);
export const FormButtons = ({ submitText = 'Create', onCancel }) => (
<div>
<Button type="submit" ripple raised primary icon="add">
<Icon name="add" />&nbsp;&nbsp;&nbsp;
{ submitText }
</Button>
&nbsp;
<Button type="cancel" ripple raised onClick={onCancel} style={{ float: 'right' }}>
<Icon name="cancel" />&nbsp;&nbsp;&nbsp;
Cancel
</Button>
</div>
);
2016-12-10 12:21:27 +01:00
export const SwitchWithLabel = ({ onChange, children, checked }) => (
<span>
<span style={{ cursor: 'pointer', display: 'inline-block', width: '45px' }}>
<Switch onChange={onChange} checked={checked} />
</span>
<span>{children}</span>
</span>
);