Sha256: 14b7bbcfd800db749c338f889fc75449370e5f5e417b37c33e3c4ba3493d05d3

Contents?: true

Size: 834 Bytes

Versions: 11

Compression:

Stored size: 834 Bytes

Contents

import React, { Component } from "react";
import PropTypes from "prop-types";

const propTypes = {
  text: PropTypes.string.isRequired,
  tag: PropTypes.string,
  color: PropTypes.string,
  dark: PropTypes.bool
};

const defaultProps = {
  text: "Hello Body Component",
  tag: "p",
  color: "",
  dark: false
};

class Body extends Component {
  render() {
    const { tag, text, color, dark } = this.props;
    // If color prop is not an empty string then render the given class
    const colorstyle = color !== "" ? `_${color}` : "";

    // If dark prop is true add the '-dark' class
    const themestyle = dark === true ? "_dark" : "";

    const Tag = `${tag}`;

    return <Tag className={"body" + colorstyle + themestyle}>{text}</Tag>;
  }
}

Body.propTypes = propTypes;
Body.defaultProps = defaultProps;

export default Body;

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
playbook_ui-2.8.7 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.8.6 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.8.5 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.8.4 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.8.3 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.8.1 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.7.2 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.7.1 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.7.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.6.0 app/pb_kits/playbook/pb_body/_body.jsx
playbook_ui-2.5.0 app/pb_kits/playbook/pb_body/_body.jsx