Sha256: 80b9fd85e49af3624a83f9d082cd7941f189a264626fe497b14d2f9f764d87f6

Contents?: true

Size: 1.71 KB

Versions: 205

Compression:

Stored size: 1.71 KB

Contents

import React, { useContext } from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../../utilities/props'
import { globalProps, GlobalProps } from '../../utilities/globalProps'

import { CloseIcon } from '../_close_icon'
import { DialogContext } from '../_dialog_context'
import Flex from '../../pb_flex/_flex'
import SectionSeparator from '../../pb_section_separator/_section_separator'

type DialogHeaderProps = {
  aria?: {[key: string]: string},
  children: React.ReactNode[] | React.ReactNode | string,
  className?: string,
  closeable?: boolean,
  data?: object,
  id?: string,
  padding?: string,
  separator?: boolean,
  spacing?: "none" | "between" | "around" | "evenly",
  text?: string,
  title?: string,
} & GlobalProps

const DialogHeader = (props: DialogHeaderProps) => {
  const {
    aria = {},
    children,
    className,
    data = {},
    padding = "sm",
    spacing = "between",
    closeable = true,
    separator = true,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const api = useContext(DialogContext)
  const headerCSS = buildCss("dialog_header")
  const headerSpacing = globalProps(props, { padding })

  /* eslint-disable react/jsx-handler-names */

  return (
    <div className="dialog_sticky_header">
      <Flex
          {...ariaProps}
          {...dataProps}
          className={classnames(headerCSS, headerSpacing, className)}
          spacing={spacing}
      >
        {children}
        {closeable &&
          <CloseIcon
            onClose={api.onClose}
          />
        }
        
      </Flex>
      {separator &&
        <SectionSeparator />
      }
    </div>
  )
}

export default DialogHeader

Version data entries

205 entries across 205 versions & 1 rubygems

Version Path
playbook_ui-12.34.0.pre.alpha.fixdialogcloseevents1004 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.34.0.pre.alpha.fixdialogcloseevents1003 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.34.0.pre.alpha.play716popoverkitcloseonclickissue998 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.34.0 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.33.1.pre.alpha.PLAY933navkitcollapsible994 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.33.1 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.33.0.pre.alpha.PLAY905reactionbuttons982 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.33.0.pre.alpha.PLAY905reactionbuttons979 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.33.0.pre.alpha.revert2650closedialogonoutsideclick977 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.33.0 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.32.0 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.hoverrails951 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.hoverrails948 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns944 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns941 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs935 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs933 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.datepickerdisableddatefix931 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0.pre.alpha.customiconsfa928 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-12.31.0 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx