@@ -9,9 +9,7 @@ import 'flexboxgrid';
99import './main.css' ;
1010import AppBar from '@material-ui/core/AppBar' ;
1111import Card from '@material-ui/core/Card' ;
12- import CardActions from '@material-ui/core/CardActions' ;
1312import CardContent from '@material-ui/core/CardContent' ;
14- import GridList from '@material-ui/core/GridList' ;
1513import ExpandMore from '@material-ui/icons/ExpandMore' ;
1614import CardHeader from '@material-ui/core/CardHeader' ;
1715import GridListTile from '@material-ui/core/GridListTile' ;
@@ -23,18 +21,18 @@ import TextField from '@material-ui/core/TextField';
2321import Switch from '@material-ui/core/Switch' ;
2422import FormControlLabel from '@material-ui/core/FormControlLabel' ;
2523import Collapse from '@material-ui/core/Collapse' ;
26- import { MuiThemeProvider , createMuiTheme } from '@material-ui/core/styles' ;
24+ import { createMuiTheme , MuiThemeProvider } from '@material-ui/core/styles' ;
2725import color from '@material-ui/core/colors/blueGrey' ;
2826
2927import UndoIcon from '@material-ui/icons/Undo' ;
3028import RedoIcon from '@material-ui/icons/Redo' ;
3129import DeleteIcon from '@material-ui/icons/Delete' ;
3230import SaveIcon from '@material-ui/icons/Save' ;
3331import ClearIcon from '@material-ui/icons/Clear' ;
32+ import AddIcon from '@material-ui/icons/Add' ;
3433import DownloadIcon from '@material-ui/icons/CloudDownload' ;
3534import ZoomInIcon from '@material-ui/icons/ZoomIn' ;
3635import ZoomOutIcon from '@material-ui/icons/ZoomOut' ;
37- import RemoveIcon from '@material-ui/icons/Remove' ;
3836import dataJson from './data.json' ;
3937import dataJsonControlled from './data.json.controlled' ;
4038import { SketchField , Tools } from '../src' ;
@@ -145,6 +143,7 @@ class SketchFieldDemo extends React.Component {
145143 expandBack : false ,
146144 expandImages : false ,
147145 expandControlled : false ,
146+ text : 'a text, cool!' ,
148147 } ;
149148 }
150149
@@ -263,6 +262,8 @@ class SketchFieldDemo extends React.Component {
263262 }
264263 } ;
265264
265+ _addText = ( ) => this . _sketch . addText ( this . state . text ) ;
266+
266267 componentDidMount = ( ) => {
267268 ( function ( console ) {
268269 console . save = function ( data , filename ) {
@@ -427,6 +428,23 @@ class SketchFieldDemo extends React.Component {
427428 < ZoomOutIcon />
428429 </ IconButton >
429430 < br />
431+ < div className = "row" >
432+ < div className = "col-lg-7" >
433+ < TextField
434+ label = 'Text'
435+ helperText = 'Add text to Sketch'
436+ onChange = { ( e ) => this . setState ( { text : e . target . value } ) }
437+ value = { this . state . text } />
438+ </ div >
439+ < div className = "col-lg-3" >
440+ < IconButton
441+ color = "primary"
442+ onClick = { this . _addText } >
443+ < AddIcon />
444+ </ IconButton >
445+ </ div >
446+ </ div >
447+
430448 < br />
431449 < FormControlLabel
432450 control = {
0 commit comments