diff --git a/packages/my-joyent/src/components/package/index.js b/packages/my-joyent/src/components/package/index.js index 4c63a145..39844d2b 100644 --- a/packages/my-joyent/src/components/package/index.js +++ b/packages/my-joyent/src/components/package/index.js @@ -16,20 +16,26 @@ const PackageStyled = styled(Card)` margin-bottom: ${remcalc(18)}; `; -const Package = ({ pack: { price, memory, vcpus, disk, group } }) => ( - - - - ${price} per hour - {memory} GB RAM - {vcpus} vCPUs - {disk / 100} TB disk - SSD +const Package = ({ + pack: { price, memory, vcpus, disk, group }, + selected, + onClick + }) => ( + + + + ${price} per hour + {memory} GB RAM + {vcpus} vCPUs + + {disk / 100} TB disk + + SSD - {group} - - - -); + {group} + + + + ); export default Package; diff --git a/packages/my-joyent/src/components/packages/list.js b/packages/my-joyent/src/components/packages/list.js index b14b3d94..53fba0e0 100644 --- a/packages/my-joyent/src/components/packages/list.js +++ b/packages/my-joyent/src/components/packages/list.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { Component } from 'react'; import remcalc from 'remcalc'; import styled from 'styled-components'; import { Col } from 'react-styled-flexboxgrid'; @@ -15,18 +15,45 @@ const ListStyled = styled.section` margin-right: -0.5rem; margin-left: -0.5rem; `; -const Packages = ({ packages }) => ( - - {packages.length > 0 ? ( - packages.map(pack => ( - - - - )) - ) : ( - 'There are no packages that meet your criteria' - )} - -); + +class Packages extends Component { + constructor() { + super(); + + this.state = { + selected: null + }; + + this.handleClick = this.handleClick.bind(this); + } + + handleClick(i) { + this.setState({ + selected: i + }); + } + render() { + const { packages } = this.props; + const { selected } = this.state; + + return ( + + {packages.length > 0 ? ( + packages.map((pack, i) => ( + + this.handleClick(i)} + selected={selected === i} + /> + + )) + ) : ( + 'There are no packages that meet your criteria' + )} + + ); + } +} export default Packages; diff --git a/packages/ui-toolkit/src/card/card.js b/packages/ui-toolkit/src/card/card.js index f822bfbc..d62b8fd9 100644 --- a/packages/ui-toolkit/src/card/card.js +++ b/packages/ui-toolkit/src/card/card.js @@ -42,6 +42,13 @@ const StyledCard = Row.extend` box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.05); min-height: ${remcalc(185)}; min-width: 292px; + cursor: pointer; + transition: all 300ms ease; + `}; + + ${is('transparent', 'selected')` + border: 1px solid ${props => props.theme.blue}; + background: ${props => props.theme.tertiaryActive}; `}; ${is('stacked')` diff --git a/packages/ui-toolkit/src/card/footer.js b/packages/ui-toolkit/src/card/footer.js index e7b711e2..8711292a 100644 --- a/packages/ui-toolkit/src/card/footer.js +++ b/packages/ui-toolkit/src/card/footer.js @@ -1,4 +1,5 @@ import { Subscriber } from 'react-broadcast'; +import is from 'styled-is'; import styled from 'styled-components'; import Baseline from '../baseline'; import typography from '../typography'; @@ -26,11 +27,15 @@ const Span = styled.span` text-transform: uppercase; color: rgba(73, 73, 73, 0.5); + + ${is('selected')` + color: rgba(41, 49, 194, 0.5); + `}; `; -const Footer = ({ children }) => { +const Footer = ({ children, selected }) => { const render = () => ( - {children} + {children} ); diff --git a/packages/ui-toolkit/src/card/title.js b/packages/ui-toolkit/src/card/title.js index 0a760c20..8df30bfd 100644 --- a/packages/ui-toolkit/src/card/title.js +++ b/packages/ui-toolkit/src/card/title.js @@ -37,6 +37,10 @@ const Container = styled.div` justify-content: center; padding: 0 ${remcalc(18)}; `}; + + ${is('selected')` + color: ${props => props.theme.blue}; + `}; `; const Span = styled.span` diff --git a/packages/ui-toolkit/src/card/usage.md b/packages/ui-toolkit/src/card/usage.md index 60b5bb4a..86427aaf 100644 --- a/packages/ui-toolkit/src/card/usage.md +++ b/packages/ui-toolkit/src/card/usage.md @@ -82,6 +82,35 @@ const { ``` +``` +const { + CardDescription, + CardHeader, + CardMeta, + CardOptions, + CardOutlet, + CardSubTitle, + CardTitle, + CardView, + CardGroupView, + CardFooter +} = require('./'); + + + + + $0.016 per hour + 0.256 GB RAM + 0.25 vCPUs + 0.01 TB disk + SSD + + Compute Optimise + + + +``` + #### `headed` ```