From fba442270bdbdf5fa87a4fa75537d26b493a39d2 Mon Sep 17 00:00:00 2001 From: Edward Raffaele Date: Tue, 7 Mar 2017 13:11:23 -0800 Subject: [PATCH] feat(cards): large card fragments adds additional card fragments --- src/components/LargeCard/LargeCard.jsx | 15 +++--- src/components/LargeCard/LargeCardContent.jsx | 20 ++++++++ .../LargeCard/LargeCardKeyValue.jsx | 20 ++++++++ .../LargeCard/LargeCardRecentList.jsx | 50 +++++++++++++++++++ src/components/StopStartButton.jsx | 7 +-- src/styles/components/large-card.css | 48 ++++++++---------- stories/card.stories.js | 27 +++++++++- 7 files changed, 149 insertions(+), 38 deletions(-) create mode 100644 src/components/LargeCard/LargeCardContent.jsx create mode 100644 src/components/LargeCard/LargeCardKeyValue.jsx create mode 100644 src/components/LargeCard/LargeCardRecentList.jsx diff --git a/src/components/LargeCard/LargeCard.jsx b/src/components/LargeCard/LargeCard.jsx index 6b56e72..c79cbfa 100644 --- a/src/components/LargeCard/LargeCard.jsx +++ b/src/components/LargeCard/LargeCard.jsx @@ -6,6 +6,9 @@ import Icon from '../suir/icon/Icon' import LargeCardAction from './LargeCardAction' import LargeCardClose from './LargeCardClose' import LargeCardGutter from './LargeCardGutter' +import LargeCardContent from './LargeCardContent' +import LargeCardKeyValue from './LargeCardKeyValue' +import LargeCardRecentList from './LargeCardRecentList' import '../../styles/components/large-card.css' @@ -17,14 +20,14 @@ class LargeCard extends React.Component { static Action = LargeCardAction; static Close = LargeCardClose; static Gutter = LargeCardGutter; - + static Content = LargeCardContent; + static KeyValue = LargeCardKeyValue; + static RecentList = LargeCardRecentList; render () { return ( -
- - - - {this.props.children} +
+ + {this.props.children}
) diff --git a/src/components/LargeCard/LargeCardContent.jsx b/src/components/LargeCard/LargeCardContent.jsx new file mode 100644 index 0000000..a421c2a --- /dev/null +++ b/src/components/LargeCard/LargeCardContent.jsx @@ -0,0 +1,20 @@ +import React from 'react' +import Flexbox from 'flexbox-react' + +const LargeCardContent = (props) => { + return ( + + {props.children} + + ) +} + +LargeCardContent.defaultProps = { + +} + +LargeCardContent.propTypes = { + +} + +export default LargeCardContent diff --git a/src/components/LargeCard/LargeCardKeyValue.jsx b/src/components/LargeCard/LargeCardKeyValue.jsx new file mode 100644 index 0000000..91a3bb4 --- /dev/null +++ b/src/components/LargeCard/LargeCardKeyValue.jsx @@ -0,0 +1,20 @@ +import React from 'react' + +const LargeCardKeyValue = (props) => { + return ( +
+ {props.name} + {props.value} +
+ ) +} + +LargeCardKeyValue.defaultProps = { + +} + +LargeCardKeyValue.propTypes = { + +} + +export default LargeCardKeyValue diff --git a/src/components/LargeCard/LargeCardRecentList.jsx b/src/components/LargeCard/LargeCardRecentList.jsx new file mode 100644 index 0000000..16161e5 --- /dev/null +++ b/src/components/LargeCard/LargeCardRecentList.jsx @@ -0,0 +1,50 @@ +import React from 'react' +import Icon from '../suir/icon/Icon'; +import Flexbox from 'flexbox-react' + +const LargeCardRecentList = (props) => { + return ( + + +

Recent

+ {props.items.map((item) => { + let icon = ''; + switch(item.state){ + case 'warning': + icon = 'icon_error-triangle_alt' + break; + case 'critical': + icon = 'icon_error-circle_alt' + break; + default: + icon = 'icon_check_alt2' + } + return( + + + + + + {item.status} + + + {item.date} + + + ) + }) + } + +
+ ) +} + +LargeCardRecentList.defaultProps = { + +} + +LargeCardRecentList.propTypes = { + items: React.PropTypes.array +} + +export default LargeCardRecentList diff --git a/src/components/StopStartButton.jsx b/src/components/StopStartButton.jsx index 49be12a..1e04b07 100644 --- a/src/components/StopStartButton.jsx +++ b/src/components/StopStartButton.jsx @@ -1,15 +1,16 @@ import React from 'react' +import Icon from './suir/icon/Icon'; import '../styles/components/stop-start-button.css' const StopStartButton = (props) => { let iconClass = '' if (props.isStopped) { - iconClass = 'icon_pause_alt2 stop-start-button' + iconClass = 'ei icon_pause_alt2 stop-start-button' } else { - iconClass = 'arrow_triangle-right_alt2 stop-start-button' + iconClass = 'ei arrow_triangle-right_alt2 stop-start-button' } return ( - + ) } diff --git a/src/styles/components/large-card.css b/src/styles/components/large-card.css index 0e5f93d..d31087c 100644 --- a/src/styles/components/large-card.css +++ b/src/styles/components/large-card.css @@ -3,7 +3,7 @@ .text-large{ font-size: 20px !important; } -.console__box__fullview { +.large_card { background: #F0F0F1; left: 0; min-height: 100%; @@ -37,13 +37,20 @@ .star_gray{ color: var(--buttonBorder) !important; } -.console__box__fullview__container { +.large_card__container { background: white; clear: fix; margin: 10px 20px 10px 20px; min-height: 94%; position: relative; - + & .label { + display: block; + font-size: 10px; + color: rgb(166, 168, 171); + text-transform: uppercase; + text-align: left; + margin-bottom: 10px; + } & .close__fullview { cursor: pointer; position: absolute; @@ -69,7 +76,7 @@ @neat-span-columns 8; padding: 10px 0px; } - & .console__box__name{ + & .title{ font-size: 1.25em; } & .fullview__quickinfo__heading { @@ -174,36 +181,24 @@ & .header{ margin-bottom: 20px !important; } - & .history__recent__activities { - @neat-span-columns 4 8; - & .recent__activity__heading { - display: block; - font-size: 11.2px; - font-size: 0.7rem; - color: rgb(166, 168, 171); - text-transform: uppercase; - text-align: left; + + & .recent__activity__row { margin-bottom: 10px; - - } - & .recent__activity__row { - margin-bottom: 10px; - & .activity__date { - margin-left: 20px; - } + & .activity__date { + margin-left: 20px; } } + - & .summary__count { + & .summary_info { color: color(var(--gray)); text-align: left; padding: 0 5px; @neat-span-columns 2 8; & .label { display: block; - font-size: 11.2px; - font-size: 0.7rem; + font-size: 10px; color: rgb(166, 168, 171); text-transform: uppercase; text-align: left; @@ -213,7 +208,7 @@ text-align: left; padding: 25px 0 15px 0; color: var(--twgray); - font-size: 2.75rem; + font-size: 38px; font-weight: 300; } } @@ -280,10 +275,7 @@ background-color: var(--blue); color: white; } - & .console__box__favorite { - cursor: pointer; - - color: var(--yellow); + & .large_card__favorite { font-size: 1.3rem; } } diff --git a/stories/card.stories.js b/stories/card.stories.js index b081e98..896ee79 100644 --- a/stories/card.stories.js +++ b/stories/card.stories.js @@ -3,6 +3,8 @@ import Flexbox from 'flexbox-react' import { storiesOf } from '@kadira/storybook' import MicroCard from '../src/components/MicroCard/MicroCard' import LargeCard from '../src/components/LargeCard/LargeCard' +import FavoriteButton from '../src/components/FavoriteButton' +import { Icon } from 'semantic-ui-react' const card = { id: 0, @@ -19,10 +21,19 @@ const alertIconUri = require('../src/assets/alert-icon.svg') function handleMe () { console.log('Handle the click action') } - +const items = [ + { + id: 0, + state: 'normal', + name: 'text', + status: 'OPERATION COMPLETED', + date: '9/12/2016' + } +] storiesOf('Cards', module) .add('Micro Card', () => (
+ @@ -53,6 +64,20 @@ storiesOf('Cards', module)
+ + + Title + + + + + + + + + + +