mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 05:10:08 +08:00
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import styles from './ConfigureCard.css';
|
|
import { Card } from 'coral-ui';
|
|
import { Checkbox } from 'react-mdl';
|
|
import cn from 'classnames';
|
|
|
|
const ConfigureCard = ({
|
|
title,
|
|
children,
|
|
className,
|
|
onCheckbox,
|
|
checked,
|
|
...rest
|
|
}) => (
|
|
<Card
|
|
{...rest}
|
|
className={cn(styles.card, className, {
|
|
[styles.enabledSetting]: checked === true,
|
|
[styles.disabledSetting]: checked === false,
|
|
})}
|
|
>
|
|
{checked !== undefined && (
|
|
<div className={styles.action}>
|
|
<Checkbox onChange={onCheckbox} checked={checked} />
|
|
</div>
|
|
)}
|
|
<div
|
|
className={cn(styles.wrapper, {
|
|
[styles.content]: checked !== undefined,
|
|
})}
|
|
>
|
|
<div className={styles.header}>{title}</div>
|
|
<div
|
|
className={cn({
|
|
[styles.disabledSettingText]: checked === false,
|
|
})}
|
|
>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
</Card>
|
|
);
|
|
|
|
ConfigureCard.propTypes = {
|
|
title: PropTypes.string.isRequired,
|
|
className: PropTypes.string,
|
|
onCheckbox: PropTypes.func,
|
|
checked: PropTypes.bool,
|
|
children: PropTypes.node,
|
|
};
|
|
|
|
export default ConfigureCard;
|