Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Add an inner class to the Card Component #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/BaseComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Registry from '../utils/Registry';
import { makeKey } from '../utils/utils';
import { qFromParams, getOwnQueryParams, getFID, objToQueryString } from '../utils/paramRouting';

const CARD_VARS = ['header', 'footer', 'iconClass', 'cardStyle', 'cardClasses', 'subheader', 'topmatter', 'subheader2', 'topmatter2', 'footerHeader', 'footerSubheader', 'bottommatter', 'footerSubheader2', 'bottommatter2'];
const CARD_VARS = ['header', 'footer', 'iconClass', 'cardStyle', 'cardClasses', 'cardInnerClasses', 'subheader', 'topmatter', 'subheader2', 'topmatter2', 'footerHeader', 'footerSubheader', 'bottommatter', 'footerSubheader2', 'bottommatter2'];

export default class BaseComponent extends Component {

Expand Down
35 changes: 19 additions & 16 deletions src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class Card extends Component {
let style = props.style || {};
let regions = {};
let classNames = (props.cardClasses || []).join(' ') || '';
let classInnerNames = (props.cardInnerClasses || []).join(' ') || '';

CARD_REGIONS.forEach(region => {
if (props[region]) {
Expand All @@ -28,22 +29,24 @@ export default class Card extends Component {

return (
<div className={'card card-' + props.cardStyle + ' ' + classNames} style={style}>
<div className="card-top">
{regions.header}
{regions.subheader}
{regions.topmatter}
{regions.subheader2}
{regions.topmatter2}
</div>
<div className="card-content">
{props.children}
</div>
<div className="card-bottom">
{regions.footerHeader}
{regions.footerSubheader}
{regions.bottommatter}
{regions.footerSubheader2}
{regions.bottommatter2}
<div className={ 'card-inner ' + classInnerNames }>
<div className="card-top">
{regions.header}
{regions.subheader}
{regions.topmatter}
{regions.subheader2}
{regions.topmatter2}
</div>
<div className="card-content">
{props.children}
</div>
<div className="card-bottom">
{regions.footerHeader}
{regions.footerSubheader}
{regions.bottommatter}
{regions.footerSubheader2}
{regions.bottommatter2}
</div>
</div>
</div>
)
Expand Down