From aadcb1121689450baa4793970499bb7429ed6845 Mon Sep 17 00:00:00 2001 From: Edward Raffaele Date: Sun, 5 Mar 2017 09:21:56 -0800 Subject: [PATCH] feat(microcard): adds microcard decomposed console box into new higher level microcard component --- src/assets/alert-white-bg.svg | 15 ++++++ src/assets/warning-yellow-whitebg.svg | 19 +++++++ src/components/MicroCard.jsx | 61 +++++++++++++++++++++ src/styles/components/micro-card.css | 77 +++++++++++++++++++++++++++ stories/microcard.stories.js | 53 ++++++++++++++++++ 5 files changed, 225 insertions(+) create mode 100644 src/assets/alert-white-bg.svg create mode 100644 src/assets/warning-yellow-whitebg.svg create mode 100644 src/components/MicroCard.jsx create mode 100644 src/styles/components/micro-card.css create mode 100644 stories/microcard.stories.js diff --git a/src/assets/alert-white-bg.svg b/src/assets/alert-white-bg.svg new file mode 100644 index 0000000..b6ea6bc --- /dev/null +++ b/src/assets/alert-white-bg.svg @@ -0,0 +1,15 @@ + + + + Group + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/warning-yellow-whitebg.svg b/src/assets/warning-yellow-whitebg.svg new file mode 100644 index 0000000..603ba8c --- /dev/null +++ b/src/assets/warning-yellow-whitebg.svg @@ -0,0 +1,19 @@ + + + + warning-yellow-whitebg + Created with Sketch. + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/MicroCard.jsx b/src/components/MicroCard.jsx new file mode 100644 index 0000000..5d68ec4 --- /dev/null +++ b/src/components/MicroCard.jsx @@ -0,0 +1,61 @@ +import React from 'react' +import Flexbox from 'flexbox-react' +import FavoriteButton from './FavoriteButton' +import { Icon } from 'semantic-ui-react' +import '../styles/components/micro-card.css' + +const MicroCard = (props) => { + console.log(props) + return ( + + { + (props.cardContent.gutter) + ? ( + + ) + : '' + } + + {props.cardContent.title} + + {props.children} + + + + {props.cardContent.count + ? {props.cardContent.count} + : '' + } + + + + + + { + (props.cardContent.showArrow) + ? ( + + + + ) : '' + } + + + ) +} + +MicroCard.defaultProps = { + +} + +MicroCard.propTypes = { + cardContent: React.PropTypes.object + +} + +export default MicroCard diff --git a/src/styles/components/micro-card.css b/src/styles/components/micro-card.css new file mode 100644 index 0000000..119545f --- /dev/null +++ b/src/styles/components/micro-card.css @@ -0,0 +1,77 @@ + +@import '../variables.css'; + + + +.microcard { + cursor: pointer; + display: block; + float: left; + color: var(--darkgray); + width: 300px; + font-size: var(--small); + margin-bottom: 10px; + min-height: 86px; + position: relative; + & .text-uppercase { + text-transform: uppercase; + } + &.bordered { + /* border: 2px solid color(var(--yellow)); */ + border: 2px solid color(var(--lightgray)); + } + & .box__header { + font-size: 1.2em; + color: var(--textGray); + } + + & .microcard_favorite { + position: absolute; + right: 10px; + top: 5px; + + } + & .microcard__message { + display: block; + + + text-transform: uppercase; + & h3, & h4 { + margin: 0; + } + & h3 { + font-size: 17.5px; + font-weight: 400; + } + & h4 { + font-size: 12px; + } + } + & .microcard__stateIcon { + + width: 25px; + height: 48px; + + } + & .microcard__count { + bottom: 20px; + font-size: 2.65rem; + position: absolute; + right: 25px; + color: #A6A8AB; + } +} + + +.microcard__arrow-right { + bottom: 0; + padding: 5px 1px 5px 3px !important; + position: absolute; + right: 0; + height: 38px !important; + margin: 0px !important; + font-size: 28px !important; + text-align: center; + vertical-align: middle; + +} diff --git a/stories/microcard.stories.js b/stories/microcard.stories.js new file mode 100644 index 0000000..9a18fc7 --- /dev/null +++ b/stories/microcard.stories.js @@ -0,0 +1,53 @@ +import React from 'react' +import Flexbox from 'flexbox-react' +import { storiesOf } from '@kadira/storybook' +import MicroCard from '../src/components/MicroCard' +import colorPalette from '../src/components/colorPallete' + +const card = { + id: 0, + gutter: colorPalette.red, + isFavorited: true, + title: 'test', + showArrow: true +} + +const cardSecond = { + id: 1, + isFavorited: false, + title: 'second test', + showArrow: true, + count: 28 +} + +const alertIconUri = require('../src/assets/alert-icon.svg') + +storiesOf('Micro Card', module) + .add('Micro Card', () => ( +
+ + + + icon + + +

connection error

+

DATABASE

+
+
+
+ + + + + icon + + +

connection error

+

DATABASE

+
+
+
+ +
+ ))