import React, { Component } from 'react'; import { compose, graphql } from 'react-apollo'; // Import { connect } from 'react-redux'; import styled from 'styled-components'; // Import { Link } from 'react-router-dom'; import ServicesQuery from '@graphql/Services.gql'; import { processServices } from '@root/state/selectors'; import { LayoutContainer } from '@components/layout'; import { Loader, ErrorMessage } from '@components/messaging'; import { ServiceListItem } from '@components/services'; const StyledContainer = styled.div` position: relative; `; class ServiceList extends Component { render() { const { deploymentGroup, services, loading, error } = this.props; if (loading) { return ( ); } else if (error) { return ( ); } const serviceList = services.map(service => ( )); return (
{/*
*/} {serviceList} {/* */}
); } } const ServicesGql = graphql(ServicesQuery, { options(props) { return { variables: { deploymentGroupSlug: props.match.params.deploymentGroup } }; }, props: ({ data: { deploymentGroup, loading, error } }) => ({ deploymentGroup, services: deploymentGroup ? processServices(deploymentGroup.services, null) : null, loading, error }) }); const ServiceListWithData = compose(ServicesGql)(ServiceList); export default ServiceListWithData;