Sha256: 704ca3f16a86229e01c7c941edf8572e684d1e0633f46538a39c3cf9dff73d7d

Contents?: true

Size: 1.9 KB

Versions: 643

Compression:

Stored size: 1.9 KB

Contents

import React, { useContext } from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } 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?: {[key: string]: string},
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  padding?: string,
  separator?: boolean,
  spacing?: "none" | "between" | "around" | "evenly",
  text?: string,
  title?: string,
} & GlobalProps

const DialogHeader = (props: DialogHeaderProps): React.ReactElement => {
  const {
    aria = {},
    children,
    className,
    data = {},
    htmlOptions = {},
    spacing = "between",
    closeable = true,
    separator = true,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)
  const api = useContext(DialogContext)
  const headerCSS = buildCss("dialog_header")
  const headerSpacing = globalProps(props)

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

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

export default DialogHeader

Version data entries

643 entries across 643 versions & 1 rubygems

Version Path
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2034 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2023 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2010 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.PLAY11642006 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary1995 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary1993 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.PLAY11641992 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.PLAY11641991 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0.pre.alpha.fonttest1972 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.play1141iconkitusinglibrary1956 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.16.0 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.play10841940 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.1132globalpropdatepickerspacing1929 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.PLAY10851907 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.PLAY11311893 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.reactselectbump581876 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.15.0.pre.alpha.PLAY10831873 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.14.0.pre.alpha.play1101betaicons1825 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.14.0.pre.alpha.play1101betaicons1798 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx
playbook_ui-13.14.0.pre.alpha.play1120lintdatepicker1797 app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx