// eslint-disable-next-line
const preact = require('preact');

function renderLogin({ submitLogin, submitRegister, submitDemo }) {
    const details = {
        name: '',
        password: '',
    };

    return (
        <div className="login">
            <input
                className="login-input"
                type="email"
                placeholder="username"
                onChange={e => (details.name = e.target.value)}
            />
            <input
                className="login-input"
                type="password"
                placeholder="password"
                onChange={e => (details.password = e.target.value)}
            />
            <button
                className="login-btn"
                type="submit"
                onClick={() => submitLogin(details.name, details.password)}>
                Login
            </button>
            <button
                className="login-btn"
                type="submit"
                onClick={() => submitRegister(details.name, details.password)}>
                Register
            </button>
            <button
                className="login-btn"
                type="submit"
                onClick={() => submitDemo()}>
                demo
            </button>
        </div>
    );
}

module.exports = renderLogin;
