booleanLineComponent.tsx 994 B

12345678910111213141516171819202122232425262728293031
  1. import * as React from "react";
  2. import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
  3. import { faCheck, faTimesCircle } from "@fortawesome/free-solid-svg-icons";
  4. export interface IBooleanLineComponentProps {
  5. label: string;
  6. value: boolean;
  7. }
  8. export class BooleanLineComponent extends React.Component<IBooleanLineComponentProps> {
  9. constructor(props: IBooleanLineComponentProps) {
  10. super(props);
  11. }
  12. render() {
  13. const check = this.props.value ? <FontAwesomeIcon icon={faCheck} /> : <FontAwesomeIcon icon={faTimesCircle} />
  14. const className = this.props.value ? "value check" : "value uncheck";
  15. return (
  16. <div className="textLine">
  17. <div className="label" title={this.props.label}>
  18. {this.props.label}
  19. </div>
  20. <div className={className}>
  21. {check}
  22. </div>
  23. </div>
  24. );
  25. }
  26. }