/
index.tsx
40 lines (36 loc) · 1.1 KB
/
index.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
import * as React from 'react';
import PropTypes from 'prop-types';
import {Box, safelySpreadBoxProps} from '@twilio-paste/box';
import type {BoxProps} from '@twilio-paste/box';
export interface DetailTextProps extends Omit<React.ComponentPropsWithRef<'div'>, 'children'> {
children?: React.ReactNode;
element?: BoxProps['element'];
as?: BoxProps['as'];
marginTop?: 'space0' | 'space30';
}
export const DetailText = React.forwardRef<HTMLDivElement, DetailTextProps>(
({element = 'DETAIL_TEXT', as = 'div', children, marginTop = 'space30', ...props}, ref) => {
return (
<Box
as={as}
ref={ref}
element={element}
{...safelySpreadBoxProps(props)}
marginTop={marginTop}
color="colorTextWeak"
fontSize="fontSize20"
lineHeight="lineHeight20"
fontWeight="fontWeightMedium"
>
{children}
</Box>
);
}
);
DetailText.displayName = 'DetailText';
DetailText.propTypes = {
as: PropTypes.string as any,
children: PropTypes.node,
element: PropTypes.string,
marginTop: PropTypes.oneOf(['space0', 'space30']),
};