Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
feature(components): prop-type Table
Alexander Kleincb4e481e5f0b
diff --git a/components/common/Table.js b/components/common/Table.jsindex f09899032..004b5af68 100644--- a/components/common/Table.js+++ b/components/common/Table.js@@ -1,9 +1,10 @@import React from 'react';+import PropTypes from 'prop-types';import classNames from 'classnames';import NoData from 'components/common/NoData';import styles from './Table.module.css';-export default function Table({+function Table({columns,rows,empty,@@ -45,6 +46,34 @@ export default function Table({);}+const styledObject = PropTypes.shape({+ className: PropTypes.string,+ style: PropTypes.object,+});++Table.propTypes = {+ columns: PropTypes.arrayOf(+ PropTypes.shape({+ cell: styledObject,+ className: PropTypes.string,+ header: styledObject,+ key: PropTypes.string,+ label: PropTypes.node,+ render: PropTypes.func,+ style: PropTypes.object,+ }),+ ),+ rows: PropTypes.arrayOf(PropTypes.object),+ empty: PropTypes.node,+ className: PropTypes.string,+ bodyClassName: PropTypes.string,+ rowKey: PropTypes.func,+ showHeader: PropTypes.bool,+ children: PropTypes.node,+};++export default Table;+export const TableRow = ({ columns, row }) => (<div className={classNames(styles.row, 'row')}>{columns.map(({ key, render, className, style, cell }, index) => (