import React from 'react' import Preview from '../components/builder-preview' import Bar from '../components/builder-bar' import Hints from '../components/builder-hints' import Helper from '../components/builder-helper' import Footer from '../components/footer' export default class BuilderPage extends React.Component { state = { host: undefined, badgeURL: '', placeholder: '', focus: false } handleBlur = () => this.setState({ focus: false }) handleFocus = () => this.setState({ focus: true }) handleChange = badgeURL => this.setState({ badgeURL }) handleSelect = exampleURL => this.setState({ badgeURL: exampleURL }) componentDidMount () { const forceHost = new URL(window.location.href).searchParams.get('host') this.setState({ host: (forceHost || window.location.origin) + '/', badgeURL: window.location.hash.replace(/^#/, ''), placeholder: 'badge/:subject/:status/:color?icon=github' }) } render () { const { host, placeholder, badgeURL, focus } = this.state return (
{badgeURL && }
) } }