import React from 'react'; import remcalc from 'remcalc'; import { Row } from 'react-styled-flexboxgrid'; import is from 'styled-is'; import { Button, Divider, H3, P, Chevron, typography, Card } from 'joyent-ui-toolkit'; import forceArray from 'force-array'; import styled from 'styled-components'; import { EEditor } from './editors'; const ButtonsRow = Row.extend`margin: ${remcalc(29)} 0 ${remcalc(60)} 0;`; const ServiceEnvironmentTitle = P.extend` margin: ${remcalc(13)} 0 0 0; ${is('expanded')` margin-bottom: ${remcalc(13)}; `}; `; const ServiceName = H3.extend` margin-top: 0; margin-bottom: ${remcalc(5)}; line-height: 1.6; font-size: ${remcalc(18)}; `; const ImageTitle = H3.extend` display: inline-block; margin: 0; `; const Image = styled.span` ${typography.fontFamily}; font-size: ${remcalc(15)}; `; const ServiceDivider = Divider.extend` margin: ${remcalc(13)} ${remcalc(-20)} 0 ${remcalc(-20)}; `; const ServiceCard = Card.extend` padding: ${remcalc(13)} ${remcalc(19)}; min-height: initial; `; const Dl = styled.dl`margin: 0;`; const EnvironmentChevron = styled(Chevron)`float: right;`; const EnvironmentReview = ({ environment }) => { const value = environment .map(({ name, value }) => `${name}=${value}`) .join('\n'); return ; }; export const Review = ({ handleSubmit, onEnvironmentToggle = () => null, onCancel, dirty, loading, environmentToggles, ...state }) => { const serviceList = forceArray(state.services).map(({ name, config }) => ( {name}
Image: {config.image}
{config.environment && config.environment.length ? ( ) : null} {config.environment && config.environment.length ? ( onEnvironmentToggle(name)} > Environment variables{' '} ) : null} {config.environment && config.environment.length && environmentToggles[name] ? ( ) : null}
)); return (
{serviceList}
); }; export default Review