2025-04-01 16:15:20 +02:00
|
|
|
import React from 'react'
|
|
|
|
|
2025-05-29 13:19:47 +02:00
|
|
|
/**
|
|
|
|
* A component set CSS classes to make your tables look better
|
|
|
|
*
|
|
|
|
* @component
|
|
|
|
* @param {object} props - All component props
|
|
|
|
* @param {JSX.Element} props.children - The table children, same as for a table HTML tag
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
*/
|
|
|
|
export const Table = ({ children }) => (
|
|
|
|
<TableWrapper>
|
|
|
|
<table className="tw:table tw:table-auto">{children}</table>
|
|
|
|
</TableWrapper>
|
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A component to help embed tables into a page
|
|
|
|
*
|
2023-08-29 17:08:16 +02:00
|
|
|
* Tables on mobile will almost always break the layout
|
2025-05-29 13:19:47 +02:00
|
|
|
* unless we set the overflow behaviour explicitly.
|
|
|
|
* This component takes care of that.
|
|
|
|
*
|
|
|
|
* @component
|
|
|
|
* @param {object} props - All component props
|
|
|
|
* @param {object} [props.js = undefined] - An optional Javascript Object to highlight
|
|
|
|
* @param {JSX.Element} props.children - The component children, will be rendered if props.js is not set
|
|
|
|
* @returns {JSX.Element}
|
2023-08-29 17:08:16 +02:00
|
|
|
*/
|
|
|
|
export const TableWrapper = ({ children }) => (
|
2025-05-29 13:19:47 +02:00
|
|
|
<div className="tw:max-w-full tw:overflow-x-auto">{children}</div>
|
2023-08-29 17:08:16 +02:00
|
|
|
)
|