Sha256: a10942de81ce83add0538bb1b6ac1cf895abb925847a059fdf6216f118bd00d1

Contents?: true

Size: 1.46 KB

Versions: 495

Compression:

Stored size: 1.46 KB

Contents

import React from "react";
import classnames from "classnames";
import {
  buildAriaProps,
  buildDataProps,
  buildHtmlProps,
} from "../../utilities/props";
import { globalProps } from "../../utilities/globalProps";

type TableHeaderPropTypes = {
  aria?: { [key: string]: string };
  children: React.ReactNode[] | React.ReactNode;
  className: string;
  data?: { [key: string]: string };
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
  id?: string;
  tag?: "table" | "div";
  text?: string;
};

const TableHeader = (props: TableHeaderPropTypes): React.ReactElement => {
  const {
    aria = {},
    children,
    className,
    data = {},
    htmlOptions = {},
    id,
    tag = "table",
    text
  } = props;

  const ariaProps = buildAriaProps(aria);
  const dataProps = buildDataProps(data);
  const htmlProps = buildHtmlProps(htmlOptions);
  const classes = classnames("pb_table_th", globalProps(props), className);
  const isTableTag = tag === "table";

  return (
    <>
      {isTableTag ? (
        <th
            {...ariaProps}
            {...dataProps}
            {...htmlProps}
            className={classes}
            id={id}
        >
          {text || children}
        </th>
      ) : (
        <div
            {...ariaProps}
            {...dataProps}
            {...htmlProps}
            className={classes}
            id={id}
        >
          {text || children}
        </div>
      )}
    </>
  );
};

export default TableHeader;

Version data entries

495 entries across 495 versions & 1 rubygems

Version Path
playbook_ui-14.0.0.pre.alpha.testthemeexport3533 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.updateviewcomponentgem3527 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063526 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063525 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063524 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063523 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063522 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR416formpillsizes3521 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063520 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY14923518 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY15063511 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PA1477timestampkit3509 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY14733507 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR416formpillsizes3506 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PA1477timestampkit3502 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR415starratingform3493 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR415starratingform3492 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY1475bumpaxecoredependency3483 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.PLAY14733479 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx
playbook_ui-14.0.0.pre.alpha.dependabotnpmandyarnreactjoyride2823478 app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx