import React from 'react' import PropTypes from 'prop-types' import { staticBadgeUrl } from '../lib/badge-url' export default class StaticBadgeMaker extends React.Component { static propTypes = { baseUrl: PropTypes.string, } state = { subject: '', status: '', color: '', } handleSubmit(e) { e.preventDefault() const { baseUrl } = this.props const { subject, status, color } = this.state const badgeUrl = staticBadgeUrl( baseUrl || window.location.href, subject, status, color ) document.location = badgeUrl } render() { return (
this.handleSubmit(e)}> this.setState({ subject: event.target.value })} placeholder="subject" />{' '} {} this.setState({ status: event.target.value })} placeholder="status" />{' '} {} this.setState({ color: event.target.value })} list="default-colors" placeholder="color" />{' '} {} {' '} {}
) } }