badguardhome/client/src/components/ui/Card.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-08-30 14:25:33 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import './Card.css';
const Card = ({
type, id, title, subtitle, refresh, bodyType, children,
}) => (
<div className={type ? `card ${type}` : 'card'} id={id || ''}>
{(title || subtitle) && (
<div className="card-header with-border">
<div className="card-inner">
{title && (
<div className="card-title">
{title}
</div>
)}
{subtitle && (
<div
className="card-subtitle"
dangerouslySetInnerHTML={{ __html: subtitle }}
/>
)}
2018-08-30 14:25:33 +00:00
</div>
{refresh && (
<div className="card-options">
{refresh}
</div>
)}
2018-08-30 14:25:33 +00:00
</div>
)}
<div className={bodyType || 'card-body'}>
{children}
2018-08-30 14:25:33 +00:00
</div>
</div>
);
Card.propTypes = {
2019-07-22 12:32:12 +00:00
id: PropTypes.string,
2018-08-30 14:25:33 +00:00
title: PropTypes.string,
subtitle: PropTypes.string,
bodyType: PropTypes.string,
type: PropTypes.string,
2018-08-30 14:25:33 +00:00
refresh: PropTypes.node,
children: PropTypes.node.isRequired,
};
export default Card;