const preact = require('preact');

function renderSpawnButton({ account, sendCrypSpawn }) {
    let name = '';

    if (!account) return <div>...</div>;

    return (
        <div className="columns">
            <div className="column">
                <input
                    className="input"
                    type="email"
                    placeholder="cryp name"
                    onChange={e => (name = e.target.value)}
                />
            </div>
            <div className="column is-4">
                <button
                    className="button is-dark is-fullwidth"
                    type="submit"
                    onClick={() => sendCrypSpawn(name)}>
                    Spawn 👾
                </button>
            </div>
        </div>
    );
}

module.exports = renderSpawnButton;
