-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_feature-detail.jsx
36 lines (34 loc) · 1.36 KB
/
_feature-detail.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react'
import { Card, Toolbar, CardText } from 'react-md'
import DataQuery from '../../modules/data-query'
import { SITES } from '../../graphql/queries'
import PieChart from './_pie-chart'
import getSitesExtent from '../../lib/get-sites-extent'
import { GlobalStateContext } from '../../modules/shared-components'
const FeaturePanel = ({ title, footerActions, toolbarActions, children }) => (
<Card style={{ height: '100%', width: '100%' }} className="better-box-shadow">
<Toolbar colored title={title} actions={toolbarActions} />
<CardText style={{ height: 'calc(100% - 86px)' }}>{children}</CardText>
<Toolbar style={{ fontSize: '12px', height: '24px' }} actions={footerActions} colored />
</Card>
)
export default ({ getFeatureIds, toolbarActions = [] }) => (
<GlobalStateContext.Consumer>
{({ africaOnly }) => (
<DataQuery
query={SITES}
variables={{ ids: getFeatureIds(), extent: getSitesExtent(africaOnly) }}
>
{({ sites }) => (
<FeaturePanel
title={getFeatureIds().length + ' Sites selected'}
footerActions={<div style={{ margin: 0, lineHeight: '24px' }}>Apache ECharts</div>}
toolbarActions={toolbarActions}
>
<PieChart sites={sites} />
</FeaturePanel>
)}
</DataQuery>
)}
</GlobalStateContext.Consumer>
)