Sha256: cfea200e7444238a80effb33ebc0a9901c9861f784b2ea3b2c34fff6c29daf4f

Contents?: true

Size: 959 Bytes

Versions: 6

Compression:

Stored size: 959 Bytes

Contents

/* @flow */

import React from "react"
import classnames from "classnames"

import styles from "./styles.scss"

export type BannerProps = {
  closeable?: boolean,
  children: string | React.Node | Array<React.Node>,
  onClose: () => void,
  position: "top" | "bottom",
  show?: boolean,
  style: "info" | "success" | "warning" | "danger",
}

const Banner = ({
  closeable,
  children,
  onClose,
  position,
  show,
  style,
}: BannerProps) => {
  const css = classnames([
    styles[`banner-${style}`],
    styles[show ? `show-${position}` : `hide-${position}`],
  ])
  return (
    <div className={css}>

      { children }

      <If condition={closeable}>
        <button
            className={classnames(styles.close, "close")}
            onClick={onClose}
        >
          {`×`}
        </button>
      </If>

    </div>
  )
}

Banner.defaultProps = {
  closeable: true,
  position: "top",
  show: false,
  style: "info",
}

export default Banner

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
playbook_ui-2.7.2 components/Banner/Banner.jsx
playbook_ui-2.7.1 components/Banner/Banner.jsx
playbook_ui-2.7.0 components/Banner/Banner.jsx
playbook_ui-2.6.0 components/Banner/Banner.jsx
playbook_ui-2.5.0 components/Banner/Banner.jsx
nitro_sg-3.0.2 components/Banner/Banner.jsx