Skip to content

Commit

Permalink
Merge pull request #57 from NASA-IMPACT/develop
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
olafveerman authored May 22, 2020
2 parents 4b39d33 + 89f73dc commit 92b3e94
Show file tree
Hide file tree
Showing 63 changed files with 2,199 additions and 876 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ jobs:
- checkout
- restore_cache:
<<: *restore_cache_def
# - run: yarn lint
- run: echo Skip linting
- run: yarn lint
test:
<<: *base_def
steps:
Expand Down
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Firefox",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:9000",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "http://localhost:9000/assets/scripts/app",
"path": "${workspaceFolder}/app"
}
]
},
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9000",
"sourceMapPathOverrides": {
"*": "${workspaceFolder}/*"
}
}
]
}
Binary file added app/assets/graphics/layout/app-logo-sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 22 additions & 99 deletions app/assets/scripts/components/about/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,23 @@ import {
InpageHeaderInner,
InpageHeadline,
InpageTitle,
InpageBody,
InpageBodyInner
InpageBody
} from '../../styles/inpage';
import Prose from '../../styles/type/prose';
import Dl from '../../styles/type/definition-list';

import media from '../../styles/utils/media-queries';
import { glsp } from '../../styles/utils/theme-values';
import { visuallyHidden } from '../../styles/helpers';
import { themeVal } from '../../styles/utils/general';

const AboutProse = styled(Prose)`
max-width: 40rem;
`;

const LogoList = styled(Dl)`
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-gap: 0 ${glsp()};
list-style: none;
padding: 0;
margin: 0;

dt {
grid-column: 1 / span 12;
&:not(:first-child) {
margin-top: ${glsp()};
}
}
dd {
grid-column: auto / span 12;
${media.smallUp`
grid-column: auto / span 4;
`}
}
`;
import {
Fold,
FoldTitle
} from '../../styles/fold';

const LogoLink = styled.a`
display: flex;
flex-direction: column;
flex: 1 1 100%;
align-items: center;
justify-content: center;
padding: 1rem;
height: 6rem;
position: relative;
z-index: 1;
border-radius: ${themeVal('shape.rounded')};
box-shadow: inset 0 0 0 1px ${themeVal('color.baseAlphaB')};
transition: all .16s ease 0s;
import Constrainer from '../../styles/constrainer';

span {
${visuallyHidden()}
}
import Prose from '../../styles/type/prose';

img {
display: inline-flex;
width: auto;
max-width: 100%;
max-height: 3rem;
}
const AboutProse = styled(Prose)`
grid-row: 1;
grid-column: span 8;
`;

// Compensate for mb logo proportions.
// const LogoLinkMb = styled(LogoLink)`
// img {
// max-height: 2rem;
// }
// `;

// Compensate for AWS logo proportions.
// const LogoLinkAWS = styled(LogoLink)`
// padding: ${glsp(0.5, 1)};

// img {
// max-height: 4.5rem;
// }
// `;

export default class About extends React.Component {
render () {
return (
Expand All @@ -103,30 +38,18 @@ export default class About extends React.Component {
</InpageHeaderInner>
</InpageHeader>
<InpageBody>
<InpageBodyInner>
<AboutProse>
<h2>The tool</h2>
<p>The COVID EO dashbord provides streaming data about the pandemic to inform decisionmakers in government, community leaders, health responders, and the business community.</p>

{/* <LogoList>
<dt>Developed by</dt>
<dd>
<LogoLink
href='https://developmentseed.org/'
title='Visit Development Seed'
rel='noopener noreferrer'
target='_blank'
>
<img
alt='Development Seed logo'
src='/assets/graphics/content/logos/ds-logo-hor--pos.svg'
/>
<span>Development Seed</span>
</LogoLink>
</dd>
</LogoList> */}
</AboutProse>
</InpageBodyInner>
<Fold>
<Constrainer>
<AboutProse>
<FoldTitle>The tool</FoldTitle>
<p>
The COVID EO dashbord provides streaming data about the
pandemic to inform decisionmakers in government, community
leaders, health responders, and the business community.
</p>
</AboutProse>
</Constrainer>
</Fold>
</InpageBody>
</Inpage>
</App>
Expand Down
2 changes: 1 addition & 1 deletion app/assets/scripts/components/common/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { appTitle, appDescription } = config;

const Page = styled(SizeAwareElement)`
display: grid;
grid-template-rows: 3rem auto 0;
grid-template-rows: minmax(3rem, min-content) auto 0;
min-height: 100vh;
`;

Expand Down
8 changes: 4 additions & 4 deletions app/assets/scripts/components/common/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,18 +558,18 @@ export const DropInset = styled.div`
background: ${_tint(0.96, themeVal('color.base'))};
color: ${_tint(0.32, themeVal('type.base.color'))};
box-shadow:
inset 0 ${themeVal('layout.border')} 0 0 ${themeVal('color.shadow')},
inset 0 -${themeVal('layout.border')} 0 0 ${themeVal('color.shadow')};
inset 0 ${themeVal('layout.border')} 0 0 ${themeVal('color.baseAlphaB')},
inset 0 -${themeVal('layout.border')} 0 0 ${themeVal('color.baseAlphaB')};
margin: -${glbS} -${glbS} ${glbS} -${glbS};
padding: ${glbS};
&:first-child {
box-shadow: inset 0 -${themeVal('layout.border')} 0 0 ${themeVal('color.shadow')};
box-shadow: inset 0 -${themeVal('layout.border')} 0 0 ${themeVal('color.baseAlphaB')};
}
&:last-child {
margin-bottom: -${glbS};
box-shadow: inset 0 ${themeVal('layout.border')} 0 0 ${themeVal('color.shadow')};
box-shadow: inset 0 ${themeVal('layout.border')} 0 0 ${themeVal('color.baseAlphaB')};
border-radius: 0 0 ${themeVal('shape.rounded')} ${themeVal('shape.rounded')};
}
Expand Down
128 changes: 128 additions & 0 deletions app/assets/scripts/components/common/gradient-legend-chart/chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import React from 'react';
import styled from 'styled-components';
import * as d3 from 'd3';

import SizeAwareElement from '../../common/size-aware-element';

import trackLayer from './track.layer';
import knobLayer from './knob.layer';

const ChartWrapper = styled.div`
flex-grow: 1;
svg {
display: block;
width: 100%;
height: 1.25rem;
}
${trackLayer.styles}
${knobLayer.styles}
`;

class DataBrowserChart extends React.Component {
constructor (props) {
super(props);
this.margin = { top: 0, right: 8, bottom: 0, left: 8 };
// Control whether the chart was rendered.
// The size aware element fires a onChange event once it is rendered
// But at that time the chart is not ready yet so we can't update the size.
this.initialized = false;

this.container = null;
this.svg = null;
this.dataCanvas = null;

this.resizeListener = this.resizeListener.bind(this);

this.trackSize = 8;
}

componentDidMount () {
this.initChart();
this.updateChart();
this.initialized = true;
}

componentDidUpdate (prevProps, prevState) {
this.updateChart();
}

resizeListener () {
if (!this.initialized) return;
this.updateChart();
}

getSize () {
if (!this.container) return { width: 0, height: 0 };
const { top, bottom, right, left } = this.margin;
const { width, height } = this.container.getSize();
return {
width: parseInt(width, 10) - left - right,
height: parseInt(height, 10) - top - bottom
};
}

initChart () {
const { top, left } = this.margin;
const containerEl = this.container.elRef.current;

this.svg = d3
.select(containerEl)
.append('svg')
.attr('class', 'chart');

// SVG definitions.
this.svg.append('defs');

this.dataCanvas = this.svg
.append('g')
.attr('class', 'data-canvas')
.attr('transform', `translate(${left},${top})`);

trackLayer.init(this);
knobLayer.init(this);
}

updateChart () {
const { top, bottom, right, left } = this.margin;
const { width, height } = this.getSize();
const { svg, dataCanvas } = this;

// ---------------------------------------------------
// Functions
this.xScale = d3
.scaleLinear()
.domain([0, 100])
.range([0, width]);

// ---------------------------------------------------
// Size updates
svg
.attr('width', width + left + right)
.attr('height', height + top + bottom);

dataCanvas.attr('width', width).attr('height', height);

trackLayer.update(this);
knobLayer.update(this);
}

render () {
return (
<SizeAwareElement
element={ChartWrapper}
trackSize={this.trackSize}
ref={el => {
this.container = el;
}}
onChange={this.resizeListener}
/>
);
}
}

DataBrowserChart.propTypes = {
};

export default DataBrowserChart;
Loading

0 comments on commit 92b3e94

Please sign in to comment.