File "Password.js"

Full path: /home/satkhirabarta/public_html/wp-content/plugins/complianz-gdpr/settings/src/Settings/Password.js
File size: 1.32 B
MIME-type: text/plain
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

import {
    Component,
} from '@wordpress/element';

class Password extends Component {
    constructor() {
        super( ...arguments );
    }

    onChangeHandler(fieldValue) {
        let fields = this.props.fields;
        let field = this.props.field;
        fields[this.props.index]['value'] = fieldValue;
        setChangedField( field.id, fieldValue )
        this.setState({
            fields: fields,
        })
    }

    render(){
        let field = this.props.field;
        let fieldValue = field.value;
        let fields = this.props.fields;

        /**
         * There is no "PasswordControl" in WordPress react yet, so we create our own license field.
         */
        return (
            <div className="components-base-control">
             <div className="components-base-control__field">
                 <label
                     className="components-base-control__label"
                     htmlFor={field.id}>{field.label}</label>
                 <input className="components-text-control__input"
                        type="password"
                        id={field.id}
                        value={fieldValue}
                        onChange={ ( e ) => this.onChangeHandler(e.target.value) }
                 />
             </div>
            </div>
        );

    }
}

export default Password;