Advertisement
danine1

index (fragment)

Mar 16th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import classnames from "classnames";
  4. import {
  5.   ContentBlock,
  6.   Header,
  7.   Icon,
  8. } from "@ematix/tesseract-component-library";
  9.  
  10. import { translate, Trans } from "react-i18next";
  11.  
  12. import AdditionalFormContainer from "./fragments/Additional";
  13.  
  14. import cls from "../../styles.scss";
  15.  
  16. @translate("BasicInformation")
  17. class AdditionalForm extends React.PureComponent {
  18.   static propTypes = {
  19.     additionalInfo: PropTypes.instanceOf(Object).isRequired,
  20.   };
  21.  
  22.   state = {
  23.     readOnly: true,
  24.   };
  25.  
  26.   toggleReadOnly = () => {
  27.     this.setState({
  28.       readOnly: !this.state.readOnly,
  29.     });
  30.   };
  31.  
  32.   render() {
  33.     const { additionalInfo } = this.props;
  34.     return (
  35.       <ContentBlock>
  36.         <Header className={cls.header}>
  37.           <h2 className={cls.title}>
  38.             <Trans>Additional Information</Trans>
  39.           </h2>
  40.           <Icon
  41.             className={classnames(cls.edit, {
  42.               [cls.active]: this.state.readOnly,
  43.             })}
  44.             onClick={this.toggleReadOnly}
  45.           >
  46.             edit
  47.           </Icon>
  48.         </Header>
  49.         <AdditionalFormContainer
  50.           additionalInfo={additionalInfo}
  51.           readOnly={this.state.readOnly}
  52.         />
  53.       </ContentBlock>
  54.     );
  55.   }
  56. }
  57.  
  58. export default AdditionalForm;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement