Skip to content

Instantly share code, notes, and snippets.

@micapam
Last active October 8, 2017 22:58
Show Gist options
  • Save micapam/91a480941ebc6c30d312c05353f2c7c0 to your computer and use it in GitHub Desktop.
Save micapam/91a480941ebc6c30d312c05353f2c7c0 to your computer and use it in GitHub Desktop.
Charts testing code - replace to see charts in app
import React from 'react';
import PropTypes from 'prop-types';
import PageWrapper from '../../PageWrapper/PageWrapper';
import CityColumnChart from '../../CityColumnChart/CityColumnChart';
import CategoryBanner from '../../CategoryBanner/CategoryBanner';
// import SubCategorySummary from '../../SubCategorySummary/SubCategorySummary';
// import getSubCategorySectionId from '../../../helpers/getSubCategorySectionId';
import { INDICATORS } from '../../../constants';
const AllCitiesCategory = (props) => {
const PAGE_CHARTS = [
{
indicatorIds: ['roadCongestionCost'],
},
{
title: 'Dwelling',
shortDescription: 'Share (%) of dwellings in a city that are',
longDescription: 'Share (%) of dwellings in a city that are',
ceiling: 1,
indicatorIds: [
'dwellingHouse',
'dwellingSemi',
'dwellingApartment',
'dwellingOther',
],
},
{
indicatorIds: ['population'],
},
{
title: 'Jobs accessible within 30 minutes by bike',
shortDescription: 'Jobs accessible within 30 minutes by bike',
longDescription: 'Jobs accessible within 30 minutes by bike',
indicatorIds: ['jobsBike'],
},
];
return (
<PageWrapper categoryId={props.category.id}>
<CategoryBanner {...props} />
<CityColumnChart
indicatorIds={['population']}
cities={props.cities}
colorBase={props.category.colorName}
/>
{PAGE_CHARTS.map(chartProps => (
<CityColumnChart
key={chartProps.indicatorIds}
cities={props.cities}
colorBase={props.category.colorName}
{...chartProps}
/>
))}
</PageWrapper>
);
};
AllCitiesCategory.propTypes = {
category: PropTypes.shape({
colorName: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
heroIndicatorId: PropTypes.oneOf(Object.keys(INDICATORS)).isRequired,
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
subCategories: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
indicatorIds: PropTypes.arrayOf(PropTypes.string).isRequired,
})).isRequired,
}).isRequired,
cities: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
indices: PropTypes.object.isRequired,
})).isRequired,
};
export default AllCitiesCategory;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment