-
-
Notifications
You must be signed in to change notification settings - Fork 775
Expand file tree
/
Copy pathindex.tsx
More file actions
37 lines (30 loc) · 751 Bytes
/
index.tsx
File metadata and controls
37 lines (30 loc) · 751 Bytes
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
import * as React from 'react';
import Mark from './Mark';
export interface MarkObj {
style?: React.CSSProperties;
label?: React.ReactNode;
}
export interface InternalMarkObj extends MarkObj {
value: number;
}
export interface MarksProps {
prefixCls: string;
marks?: InternalMarkObj[];
}
export default function Marks(props: MarksProps) {
const { prefixCls, marks } = props;
const markPrefixCls = `${prefixCls}-mark`;
// Not render mark if empty
if (!marks.length) {
return null;
}
return (
<div className={markPrefixCls}>
{marks.map(({ value, style, label }) => (
<Mark key={value} prefixCls={markPrefixCls} style={style} value={value}>
{label}
</Mark>
))}
</div>
);
}