Sha256: 81a8e1a3ccbb63707de1793a0a9f780c7a32596322e401bd5d450c3baa5d48a6

Contents?: true

Size: 1.66 KB

Versions: 365

Compression:

Stored size: 1.66 KB

Contents

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

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

const TableRow = (props: TableRowPropTypes): React.ReactElement => {
  const {
    aria = {},
    children,
    className,
    data = {},
    htmlOptions = {},
    id,
    sideHighlightColor = "none",
    tag = "table",
  } = props;

  const ariaProps = buildAriaProps(aria);
  const dataProps = buildDataProps(data);
  const htmlProps = buildHtmlProps(htmlOptions);
  const sideHighlightClass =
    sideHighlightColor != "" ? `side_highlight_${sideHighlightColor}` : null;
  const classes = classnames(
    buildCss("pb_table_row_kit", sideHighlightClass),
    "pb_table_tr",
    globalProps(props),
    className
  );
  const isTableTag = tag === "table";

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

export default TableRow;

Version data entries

365 entries across 365 versions & 1 rubygems

Version Path
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4903 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4901 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4898 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4891 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4890 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment4889 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.12 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.11 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4868 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4866 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.10 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.9 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.8 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.7 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.6 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.5 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.4 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PLAY16264818 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR702stickyleftcolrails4806 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx
playbook_ui-14.10.0.pre.rc.3 app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx