import { html, Component } from "../lib/index.js"; export default class NetworkForm extends Component { state = { username: "", password: "", }; constructor(props) { super(props); this.handleInput = this.handleInput.bind(this); this.handleSubmit = this.handleSubmit.bind(this); if (props.username) { this.state.username = props.username; } } handleInput(event) { let target = event.target; let value = target.type == "checkbox" ? target.checked : target.value; this.setState({ [target.name]: value }); } handleSubmit(event) { event.preventDefault(); this.props.onSubmit(this.state.username, this.state.password); } render() { return html`




`; } }