From 6a0b94fa0e69557b0c3bf27a8f7101892a07dda3 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 25 Oct 2018 00:07:55 +0100 Subject: [PATCH] Contact edit: upgrade material-ui. --- src/components/ContactEdit.tsx | 124 ++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 58 deletions(-) diff --git a/src/components/ContactEdit.tsx b/src/components/ContactEdit.tsx index 7b341aa..7f0533c 100644 --- a/src/components/ContactEdit.tsx +++ b/src/components/ContactEdit.tsx @@ -1,16 +1,18 @@ import * as React from 'react'; -import IconButton from 'material-ui/IconButton'; -import RaisedButton from 'material-ui/RaisedButton'; -import TextField from 'material-ui/TextField'; -import SelectField from 'material-ui/SelectField'; -import MenuItem from 'material-ui/MenuItem'; -import { red500, fullWhite } from 'material-ui/styles/colors'; -import IconDelete from 'material-ui/svg-icons/action/delete'; - -import IconAdd from 'material-ui/svg-icons/content/add'; -import IconClear from 'material-ui/svg-icons/content/clear'; -import IconCancel from 'material-ui/svg-icons/content/clear'; -import IconSave from 'material-ui/svg-icons/content/save'; +import IconButton from '@material-ui/core/IconButton'; +import Button from '@material-ui/core/Button'; +import TextField from '@material-ui/core/TextField'; +import Select from '@material-ui/core/Select'; +import MenuItem from '@material-ui/core/MenuItem'; +import FormControl from '@material-ui/core/FormControl'; +import InputLabel from '@material-ui/core/InputLabel'; +import * as colors from '@material-ui/core/colors'; + +import IconDelete from '@material-ui/icons/Delete'; +import IconAdd from '@material-ui/icons/Add'; +import IconClear from '@material-ui/icons/Clear'; +import IconCancel from '@material-ui/icons/Clear'; +import IconSave from '@material-ui/icons/Save'; import ConfirmationDialog from '../widgets/ConfirmationDialog'; @@ -46,15 +48,15 @@ const TypeSelector = (props: any) => { const types = props.types as {type: string}[]; return ( - {types.map((x) => ( - + {x.type} ))} - + ); }; @@ -74,7 +76,7 @@ interface ValueTypeComponentProps { types: {type: string}[]; name: string; - hintText: string; + placeholder: string; value: ValueType; onClearRequest: (name: string) => void; onChange: (name: string, type: string, value: string) => void; @@ -86,14 +88,14 @@ const ValueTypeComponent = (props: ValueTypeComponentProps) => { ) => props.onChange(props.name, props.value.type, event.target.value)} /> props.onClearRequest(props.name)} - tooltip="Remove" + title="Remove" > @@ -334,21 +336,23 @@ class ContactEdit extends React.PureComponent { {this.props.item ? 'Edit Contact' : 'New Contact'}
- this.handleChange('journalUid', payload)} - > - {this.props.collections.map((x) => ( - - ))} - + + + Saving to + + + this.addValueType('phone')} - tooltip="Add phone number" + title="Add phone number" > @@ -367,7 +371,7 @@ class ContactEdit extends React.PureComponent { this.removeValueType(name, idx)} @@ -381,7 +385,7 @@ class ContactEdit extends React.PureComponent { Emails this.addValueType('email')} - tooltip="Add email address" + title="Add email address" > @@ -390,7 +394,7 @@ class ContactEdit extends React.PureComponent { this.removeValueType(name, idx)} @@ -404,7 +408,7 @@ class ContactEdit extends React.PureComponent { IMPP this.addValueType('impp', 'jabber')} - tooltip="Add impp address" + title="Add impp address" > @@ -413,7 +417,7 @@ class ContactEdit extends React.PureComponent { this.removeValueType(name, idx)} @@ -427,7 +431,7 @@ class ContactEdit extends React.PureComponent { Addresses this.addValueType('address')} - tooltip="Add address" + title="Add address" > @@ -436,7 +440,7 @@ class ContactEdit extends React.PureComponent { this.removeValueType(name, idx)} @@ -448,7 +452,7 @@ class ContactEdit extends React.PureComponent {
- } - /> + > + + Cancel + {this.props.item && - } + } - } + variant="raised" + color="secondary" style={{marginLeft: 15}} - /> + > + + Save +