const React = require('react');
const {
List, ListItem, ListItemContent,
Button, Icon,
Switch,
} = require('react-mdl');
const { Link } = require('react-router');
export const shorten = (str, len = 50) => (str && str.length > len ? `${str.substring(0, len)}...` : str);
export const AppsLinkList = ({ apps }) => (
{apps.length > 0 && apps.map(({ appName, description = '-', icon = 'apps' }) => (
{appName}
))}
);
export const HeaderTitle = ({ title, actions, subtitle }) => (
{title}
{subtitle && {subtitle}}
{actions}
);
export const FormButtons = ({ submitText = 'Create', onCancel }) => (
);
export const SwitchWithLabel = ({ onChange, children, checked }) => (
{children}
);
export const TogglesLinkList = ({ toggles }) => (
{toggles.length > 0 && toggles.map(({ name, description = '-', icon = 'toggle' }) => (
{name}
))}
);
export function getIcon (type) {
switch (type) {
case 'feature-updated': return 'autorenew';
case 'feature-created': return 'add';
case 'feature-deleted': return 'remove';
case 'feature-archived': return 'archived';
default: return 'star';
}
};
export const IconLink = ({ icon, children, ...props }) => (
{children}
);
export const ExternalIconLink = ({ url, children }) => (
{children}
);