2016-01-08 18:44:35 +05:30
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import styles from './panel.scss';
|
2016-01-09 17:29:42 +05:30
|
|
|
import icons from './icons.scss';
|
2016-01-08 18:44:35 +05:30
|
|
|
|
|
|
|
export function Panel(props) {
|
2016-01-09 17:29:42 +05:30
|
|
|
var { title, icon } = props;
|
|
|
|
|
|
|
|
if (icon) {
|
|
|
|
icon = (
|
|
|
|
<button className={styles.headerControl}>
|
|
|
|
<span className={icons[icon]} />
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
2016-01-08 18:44:35 +05:30
|
|
|
|
|
|
|
if (title) {
|
|
|
|
title = (
|
|
|
|
<PanelHeader>
|
2016-01-09 17:29:42 +05:30
|
|
|
{icon}
|
2016-01-08 18:44:35 +05:30
|
|
|
{title}
|
|
|
|
</PanelHeader>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.panel}>
|
|
|
|
{title}
|
|
|
|
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function PanelHeader(props) {
|
|
|
|
return (
|
|
|
|
<div className={styles.header}>
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function PanelBody(props) {
|
|
|
|
return (
|
|
|
|
<div className={styles.body}>
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function PanelFooter(props) {
|
|
|
|
return (
|
|
|
|
<div className={styles.footer}>
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-01-09 19:21:55 +05:30
|
|
|
|
2016-01-09 21:17:21 +05:30
|
|
|
export function PanelBodyHeader(props) {
|
|
|
|
var { type = 'default' } = props;
|
2016-01-09 19:21:55 +05:30
|
|
|
|
2016-01-09 21:17:21 +05:30
|
|
|
var close;
|
|
|
|
|
|
|
|
if (type === 'error') {
|
|
|
|
close = (
|
2016-01-09 19:21:55 +05:30
|
|
|
<span className={styles.close} />
|
2016-01-09 21:17:21 +05:30
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles[`${type}BodyHeader`]}>
|
|
|
|
{close}
|
|
|
|
{props.children}
|
2016-01-09 19:21:55 +05:30
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|