import React from 'react' import { COLORS } from '../lib/constants' import Checkmark from './svg/Checkmark' import { RESOLUTIONS } from '../lib/constants' export default class extends React.Component { constructor(props) { super() this.state = { isVisible: false } this.select = this.select.bind(this) this.toggle = this.toggle.bind(this) } select(resolution) { if (this.props.selected !== resolution) { this.props.onChange(resolution) } } toggle() { this.setState({ isVisible: !this.state.isVisible }) } renderResolutions() { return RESOLUTIONS.map((resolution, i) => { return (
{resolution.name} {this.props.selected === resolution.id ? : null}
) }) } render() { const selectedResolution = RESOLUTIONS.filter(resolution => resolution.id === this.props.selected)[0] || {} return (
Resolution {selectedResolution.name}
{this.renderResolutions()}
) } }