unicornpaint

A web-based painting app for raspberry PI and pimoroni Unicorn Hat HD
Log | Files | Refs | README

SaveDialog.js (827B)


      1 import React, { Component } from 'react'
      2 import { ModalContainer, ModalDialog } from 'react-modal-dialog'
      3 
      4 export default class SaveDialog extends Component {
      5     constructor(props) {
      6         super(props)
      7         this.state = {
      8             name: ""
      9         }   
     10     }
     11 
     12     render() {
     13         return <ModalContainer onClose={this.props.onClose}>
     14         <ModalDialog onClose={this.props.onClose}>
     15           <h1>Save</h1>
     16           <form onSubmit={(event) => {
     17               this.props.onSave(this.state.name)
     18               event.preventDefault()}}>
     19             <input 
     20                 value={this.state.name}
     21                 onChange={(event) => this.setState({name: event.target.value})}/>
     22             <input
     23                 type="submit" value="Save"/>
     24           </form>
     25         </ModalDialog>
     26       </ModalContainer>
     27     }
     28 }