/
Th.tsx
51 lines (48 loc) · 1.32 KB
/
Th.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import * as React from 'react';
import PropTypes from 'prop-types';
import {Box, safelySpreadBoxProps} from '@twilio-paste/box';
import {ThPropTypes} from '@twilio-paste/table';
import type {ThProps as TableThProps} from '@twilio-paste/table';
export interface ThProps extends TableThProps {
onClick?: React.MouseEventHandler;
}
export const Th = React.forwardRef<HTMLTableCellElement, ThProps>(
({width, textAlign = 'left', element = 'DATA_GRID_TH', ...props}, ref) => {
return (
<Box
{...safelySpreadBoxProps(props)}
ref={ref}
element={element}
as="th"
borderBottomStyle="solid"
borderBottomColor="colorBorderWeaker"
borderBottomWidth="borderWidth10"
fontSize="fontSize30"
lineHeight="lineHeight30"
fontWeight="fontWeightSemibold"
paddingY="space40"
paddingX="space50"
width={width}
position="relative"
textAlign={textAlign}
verticalAlign="inherit"
color="inherit"
_first={{
paddingLeft: 'space50',
}}
_last={{
paddingRight: 'space50',
}}
_focus={{
outline: 'none',
boxShadow: 'shadowFocusInset',
}}
/>
);
}
);
Th.displayName = 'Th';
Th.propTypes = {
...ThPropTypes,
onClick: PropTypes.func,
};