Skip to content

Commit bbb64b2

Browse files
author
Kyle Kim
committed
DashboardCard + Isotope Grid Version 1
1 parent 322a2a9 commit bbb64b2

10 files changed

Lines changed: 75 additions & 17 deletions

File tree

dist/_wfui-react.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,34 @@ html {
10871087
.widget .widget__body .widget__body__header {
10881088
margin-top: 8px;
10891089
margin-bottom: 8px; }
1090+
.form-box-container {
1091+
width: 100%;
1092+
margin-bottom: 20px;
1093+
border-top: 5px solid #000; }
1094+
.form-box-container .form-box {
1095+
border: 1px solid #dadada;
1096+
border-top: none; }
1097+
.form-box-container .form-box-body {
1098+
padding: 10px 15px;
1099+
background-color: #fff; }
1100+
.form-box-container .form-box-footer {
1101+
border-top: 1px solid #dadada; }
1102+
.form-box-container .form-box-footer ul.form-box-links {
1103+
display: flex;
1104+
flex-wrap: nowrap;
1105+
list-style: none;
1106+
margin: 0;
1107+
padding: 0; }
1108+
.form-box-container .form-box-footer ul.form-box-links > li {
1109+
border-right: 1px solid #dadada;
1110+
flex: 1;
1111+
font-size: 16px;
1112+
font-weight: 600;
1113+
background-color: #f7f9fa;
1114+
text-align: center;
1115+
padding: 5px 0; }
1116+
.form-box-container .form-box-footer ul.form-box-links > li:last-child {
1117+
border-right: none; }
10901118
html {
10911119
box-sizing: border-box;
10921120
font-size: 16px; }

lib/DashboardCard/DashboardCard.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ var DashboardCardFooter = function DashboardCardFooter(_ref2) {
7070
{ key: key },
7171
(0, _react.cloneElement)(child)
7272
);
73-
}) || (0, _react.cloneElement)(children, { key: 0 })
73+
}) || _react2.default.createElement(
74+
'li',
75+
null,
76+
(0, _react.cloneElement)(children)
77+
)
7478
)
7579
) : null;
7680
};
@@ -123,12 +127,13 @@ var DashboardCard = function (_React$Component) {
123127
var _props = this.props,
124128
className = _props.className,
125129
children = _props.children,
126-
data = _props.data;
130+
data = _props.data,
131+
style = _props.style;
127132

128133

129134
return _react2.default.createElement(
130135
_Card2.default,
131-
{ className: (0, _classnames2.default)(className, 'form-box-container') },
136+
{ className: (0, _classnames2.default)(className, 'form-box-container'), cardStyle: style },
132137
_react2.default.createElement(
133138
_Card2.default.Body,
134139
{ className: 'form-box' },
@@ -153,7 +158,8 @@ var DashboardCard = function (_React$Component) {
153158
DashboardCard.propTypes = {
154159
children: _propTypes2.default.node,
155160
className: _propTypes2.default.string,
156-
data: _propTypes2.default.object
161+
data: _propTypes2.default.object,
162+
style: _propTypes2.default.object
157163
};
158164

159165
DashboardCard.Body = DashboardCardBody;

lib/IsotopeGrid/IsotopeGrid.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ var IsotopeItem = function IsotopeItem(_ref) {
6565
children = _ref.children;
6666
return width ? _react2.default.createElement(
6767
'div',
68-
{ key: key, className: (0, _classnames2.default)(id + '-item', 'wfui-isotope-item'), style: { width: width } },
68+
{
69+
key: key,
70+
className: (0, _classnames2.default)(id + '-item', 'wfui-isotope-item'),
71+
style: { width: width + 'px' }
72+
},
6973
children
7074
) : _react2.default.createElement(
7175
_reactBootstrap.Col,
@@ -320,8 +324,9 @@ IsotopeGrid.propTypes = {
320324

321325
IsotopeGrid.defaultProps = {
322326
searchTerm: '',
323-
sm: 12,
324-
md: 6,
327+
xs: 12,
328+
sm: 6,
329+
md: 4,
325330
lg: 4
326331
};
327332

lib/styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require('./CaGForms/Selection/selection.scss');
1010

1111
require('./FullCalendar/fullcalendar.min.css');
1212
require('./DashboardBox/index.scss');
13+
require('./DashboardCard/index.scss');
1314
require('./UserDrawer/index.scss');
1415
require('./FormFields/index.scss');
1516
require('./Card/index.scss');

src/DashboardCard/DashboardCard.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ const DashboardCardFooter = ({ role, className, children }) =>
2626
<div role={role} className={classNames(className, 'form-box-footer')}>
2727
<ul className="form-box-links">
2828
{(Array.isArray(children) &&
29-
children.map((child, key) => <li key={key}>{cloneElement(child)}</li>)) ||
30-
cloneElement(children, { key: 0 })}
29+
children.map((child, key) => <li key={key}>{cloneElement(child)}</li>)) || (
30+
<li>{cloneElement(children)}</li>
31+
)}
3132
</ul>
3233
</div>
3334
) : null;
@@ -63,10 +64,10 @@ const FOOTER_ROLE = DashboardCardFooter.defaultProps.role;
6364

6465
class DashboardCard extends React.Component {
6566
render() {
66-
const { className, children, data } = this.props;
67+
const { className, children, data, style } = this.props;
6768

6869
return (
69-
<Card className={classNames(className, 'form-box-container')}>
70+
<Card className={classNames(className, 'form-box-container')} cardStyle={style}>
7071
<Card.Body className="form-box">
7172
{children &&
7273
((Array.isArray(children) &&
@@ -91,6 +92,7 @@ DashboardCard.propTypes = {
9192
children: PropTypes.node,
9293
className: PropTypes.string,
9394
data: PropTypes.object,
95+
style: PropTypes.object,
9496
};
9597

9698
DashboardCard.Body = DashboardCardBody;

src/IsotopeGrid/IsotopeGrid.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ const columnProps = PropTypes.oneOfType([
2424

2525
const IsotopeItem = ({ key, id, width, xs, sm, md, lg, children }) =>
2626
width ? (
27-
<div key={key} className={classNames(`${id}-item`, 'wfui-isotope-item')} style={{ width }}>
27+
<div
28+
key={key}
29+
className={classNames(`${id}-item`, 'wfui-isotope-item')}
30+
style={{ width: `${width}px` }}
31+
>
2832
{children}
2933
</div>
3034
) : (
@@ -259,8 +263,9 @@ IsotopeGrid.propTypes = {
259263

260264
IsotopeGrid.defaultProps = {
261265
searchTerm: '',
262-
sm: 12,
263-
md: 6,
266+
xs: 12,
267+
sm: 6,
268+
md: 4,
264269
lg: 4,
265270
};
266271

src/styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require('./CaGForms/Selection/selection.scss');
88

99
require('./FullCalendar/fullcalendar.min.css');
1010
require('./DashboardBox/index.scss');
11+
require('./DashboardCard/index.scss');
1112
require('./UserDrawer/index.scss');
1213
require('./FormFields/index.scss');
1314
require('./Card/index.scss');

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 DashboardCardStyle={{ "border": "1px solid #000" }}>
3+
<DashboardCard>
44
<DashboardCard.Body>
55
<div className="form-title-container">
66
<h2 className="form-box-title">Request a Jira Project</h2>

stories/IsotopeGrid/StoryBasicExample.src

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ class IsotopeGridContainer extends React.Component {
4040
return (
4141
<div>
4242
<IsotopeGrid id="tester" searchTerm={searchTerm}>
43-
{data && data.map(item => <IsotopeGrid.Item><h1 className="isotope-search">{item}</h1></IsotopeGrid.Item>)}
43+
{data && data.map(item => (
44+
<IsotopeGrid.Item>
45+
<DashboardCard>
46+
<DashboardCard.Body>
47+
<h1 className="isotope-search">{item}</h1>
48+
</DashboardCard.Body>
49+
</DashboardCard>
50+
</IsotopeGrid.Item>
51+
))}
4452
<IsotopeGrid.Item>
4553
<h1>Test 1</h1>
4654
</IsotopeGrid.Item>

stories/IsotopeGrid/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import StoryBasicExample from 'raw!./StoryBasicExample.src';
77
import { Provider } from 'react-redux';
88
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
99
import { visibilityFilterReducer } from '../../src/util/visibilityFilter';
10+
import DashboardCard from '../../src/DashboardCard/DashboardCard';
11+
import '../../src/DashboardCard/index.scss';
1012

1113
const store = createStore(
1214
combineReducers({
@@ -16,5 +18,5 @@ const store = createStore(
1618
compose(applyMiddleware(thunk), window.devToolsExtension ? window.devToolsExtension() : f => f),
1719
);
1820
storiesOf('IsotopeGrid', module).addWithInfo('Basic Example', () => StoryBasicExample, {
19-
scope: { Provider, store, IsotopeGrid, Button, ButtonGroup },
21+
scope: { Provider, store, IsotopeGrid, DashboardCard, Button, ButtonGroup },
2022
});

0 commit comments

Comments
 (0)