Skip to content

Commit 51fb0e0

Browse files
author
Kyle Kim
committed
Dashboard Card Update
1 parent 945d550 commit 51fb0e0

3 files changed

Lines changed: 35 additions & 8 deletions

File tree

src/DashboardCard/DashboardCard.jsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { cloneElement } from 'react';
22
import PropTypes from 'prop-types';
33
import classNames from 'classnames';
44
import Card from '../Card/Card';
5+
import { stringifyValues } from '../util/stringifyValues';
56

67
const DashboardCardBody = ({ role, className, children }) => (
78
<div role={role} className={classNames(className, 'form-box-body')}>
@@ -42,16 +43,32 @@ DashboardCardFooter.defaultProps = {
4243
hover: false,
4344
};
4445

46+
const DashboardCardFilterData = ({ role, data }) => (
47+
<span role={role} className="hide isotope-search" aria-hidden="true" hidden>
48+
{stringifyValues(data)}
49+
</span>
50+
);
51+
52+
DashboardCardFilterData.propTypes = {
53+
role: PropTypes.string,
54+
data: PropTypes.object,
55+
};
56+
57+
DashboardCardFilterData.defaultProps = {
58+
role: 'filterData',
59+
};
60+
4561
const BODY_ROLE = DashboardCardBody.defaultProps.role;
4662
const FOOTER_ROLE = DashboardCardFooter.defaultProps.role;
63+
const DATA_ROLE = DashboardCardFilterData.defaultProps.role;
4764

4865
class DashboardCard extends React.Component {
4966
render() {
50-
const { className, children, cardStyle } = this.props;
67+
const { className, children, data, cardStyle } = this.props;
5168

5269
return (
53-
<Card className={classNames(className, 'form-box')} cardStyle={cardStyle}>
54-
<Card.Body>
70+
<Card className={classNames(className, 'form-box-container')}>
71+
<Card.Body className="form-box">
5572
{children &&
5673
((Array.isArray(children) &&
5774
children.map((child, key) => {
@@ -64,6 +81,7 @@ class DashboardCard extends React.Component {
6481
}
6582
})) ||
6683
cloneElement(children))}
84+
{data && <DashboardCardFilterData data={data} />}
6785
</Card.Body>
6886
</Card>
6987
);
@@ -73,7 +91,7 @@ class DashboardCard extends React.Component {
7391
DashboardCard.propTypes = {
7492
children: PropTypes.node,
7593
className: PropTypes.string,
76-
cardStyle: PropTypes.object,
94+
data: PropTypes.object,
7795
};
7896

7997
DashboardCard.Body = DashboardCardBody;

src/DashboardCard/index.scss

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
.form-box {
1+
.form-box-container {
22
width: 100%;
33
margin-bottom: 20px;
4-
border: 1px solid #dadada;
54
border-top: 5px solid #000;
65

6+
.form-box {
7+
border: 1px solid #dadada;
8+
border-top: none;
9+
}
10+
711
.form-box-body {
812
padding: 10px 15px;
913
background-color: #fff;
1014
}
1115

1216
.form-box-footer {
13-
border-right: none;
17+
border-top: 1px solid #dadada;
1418

1519
ul.form-box-links {
1620
display: flex;
@@ -20,13 +24,18 @@
2024
padding: 0;
2125

2226
> li {
27+
border-right: 1px solid #dadada;
2328
flex: 1;
2429
font-size: 16px;
2530
font-weight: 600;
2631
background-color: #f7f9fa;
2732
text-align: center;
2833
padding: 5px 0;
2934
}
35+
36+
> li:last-child {
37+
border-right: none;
38+
}
3039
}
3140
}
3241
}

stories/DashboardCard/StoryBasicExample.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const example = (
22
<div>
3-
<DashboardCard className="col-xs-4" DashboardCardStyle={{ "border": "1px solid #000" }}>
3+
<DashboardCard DashboardCardStyle={{ "border": "1px solid #000" }}>
44
<DashboardCard.Body>
55
<div className="form-title-container">
66
<h2 className="form-box-title">Request a Jira Project</h2>

0 commit comments

Comments
 (0)