sendou.ink/components/common/Table.tsx
Kalle af3a654595
Customize profile colors (#603)
* Variables rearranged

* Make patron.json empty again

* Fix styles.css

* Working prototype

* Table legible color

* UI furthened

* Set opaque theme color with custom colors

* Control Color Selector with buttons

* Show info if can't edit colors

* borzoic can also edit colors

* Add migration

* Can send colors to backend

* Edit existing colors

* Use new layering strat for footer

* useMutation custom hook

* Footer adjusted text color

* Reset style after profile visit

* Set squid color after page load

* Mutate user after color selection
2021-07-29 20:30:47 +03:00

88 lines
2.0 KiB
TypeScript

// https://github.com/chakra-ui/chakra-ui/issues/135#issuecomment-644878591
import { Box, BoxProps } from "@chakra-ui/react";
import { CSSVariables } from "utils/CSSVariables";
/**
* Represents tabular data - that is, information presented in a
* two-dimensional table comprised of rows and columns of cells containing
* data. It renders a `<table>` HTML element.
*/
export function Table(props: BoxProps) {
return (
<Box overflow="auto">
<Box as="table" width="full" {...props} />
</Box>
);
}
/**
* Defines a set of rows defining the head of the columns of the table. It
* renders a `<thead>` HTML element.
*/
export function TableHead(props: BoxProps) {
return <Box as="thead" {...props} />;
}
/**
* Defines a row of cells in a table. The row's cells can then be established
* using a mix of `TableCell` and `TableHeader` elements. It renders a `<tr>`
* HTML element.
*/
export function TableRow(props: BoxProps) {
return (
<Box
as="tr"
{...props}
_even={{ backgroundColor: CSSVariables.bgColor }}
borderRadius="5px"
/>
);
}
export function TableHeader(props: BoxProps) {
return (
<>
<Box
as="th"
px="4"
py="3"
backgroundColor={CSSVariables.themeColor}
color={CSSVariables.secondaryBgColor}
textAlign="left"
fontSize="xs"
textTransform="uppercase"
letterSpacing="wider"
lineHeight="1rem"
fontWeight="medium"
{...props}
/>
</>
);
}
/**
* Encapsulates a set of table rows, indicating that they comprise the body of
* the table. It renders a `<tbody>` HTML element.
*/
export function TableBody(props: BoxProps) {
return <Box as="tbody" {...props} />;
}
/**
* Defines a cell of a table that contains data. It renders a `<td>` HTML
* element.
*/
export function TableCell(props: BoxProps) {
return (
<Box
as="td"
px="4"
py="4"
lineHeight="1.25rem"
whiteSpace="nowrap"
{...props}
/>
);
}