diff --git a/ui/src/component/ToggleVisibility.js b/ui/src/component/ToggleVisibility.js new file mode 100644 index 0000000..a75d52f --- /dev/null +++ b/ui/src/component/ToggleVisibility.js @@ -0,0 +1,38 @@ +import React, {Component} from 'react'; +import Typography from 'material-ui/Typography'; +import IconButton from 'material-ui/IconButton'; +import VisibilityOff from 'material-ui-icons/VisibilityOff'; +import Visibility from 'material-ui-icons/Visibility'; +import PropTypes from 'prop-types'; + +class ToggleVisibility extends Component { + static propTypes = { + value: PropTypes.string.isRequired, + style: PropTypes.object, + }; + + constructor() { + super(); + this.state = {visible: false}; + } + + toggleVisibility = () => this.setState({visible: !this.state.visible}); + + render() { + const {value, style} = this.props; + const text = this.state.visible ? value : '•••••••••••••••'; + return ( +