/
BasicRow.tsx
40 lines (31 loc) · 1.12 KB
/
BasicRow.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 React from 'react';
import FlexCell from './FlexCell';
import Tag from './Tag';
import wrapIfNotElement from './utils/wrapIfNotElement';
type OwnProps = {
basic?: React.ReactNode;
tag?: React.ReactNode;
statusIcon?: React.ReactNode;
};
type Props = OwnProps & typeof BasicRow.defaultProps;
// @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type 'Props'... Remove this comment to see the full error message
function BasicRow({ basic, tag, statusIcon, children, ...otherProps }: Props) {
if (!basic) {
return null;
}
return (
<div {...otherProps}>
{/* @ts-expect-error ts-migrate(2322) FIXME: Property 'children' does not exist on type 'Intrin... Remove this comment to see the full error message */}
<FlexCell shrink>{basic}</FlexCell>
{tag && wrapIfNotElement(tag, { with: Tag })}
{statusIcon && wrapIfNotElement(statusIcon, { with: 'span' })}
{children}
</div>
);
}
BasicRow.defaultProps = {
basic: undefined,
tag: undefined,
statusIcon: undefined,
};
export default BasicRow;