-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathLabel.tsx
158 lines (135 loc) · 3.22 KB
/
Label.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import styled, { css } from "styled-components";
import { CSSProperties } from "react";
export const labelCss: any = css`
user-select: none;
font-size: 13px;
&:hover {
cursor: default;
}
`;
export const EllipsisTextCss = css`
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
`;
const TextLabelP = styled.p`
${labelCss}
display: inline-block;
margin-bottom: 0px;
min-width: 26px;
max-width: 90px;
`;
// GrayTitle
const Graylabel: any = styled.p`
${labelCss}
color: #8b8fa3;
margin-top: ${(props: any) => props.marginTop || "8px"};
margin-bottom: 8px;
`;
const Blocklabel = styled.p`
${labelCss}
margin-bottom: 0;
margin-top: 4px;
`;
interface ITextLabel {
label: string;
}
export const TextLabel = (props: ITextLabel) => {
const { label } = props;
return <TextLabelP>{label}</TextLabelP>;
};
interface IGrayLabel {
label: string;
}
export const BlockGrayLabel = (props: IGrayLabel) => {
const { label } = props;
return <Graylabel>{label}</Graylabel>;
};
interface IBlocklabel {
label: string;
}
export const BlockLabel = (props: IBlocklabel) => {
const { label } = props;
return <Blocklabel>{label}</Blocklabel>;
};
// Title text in each line of Collapse
const LeftTitle = styled.span<{
$color?: string;
$line?: number;
$hasChild?: boolean;
}>`
word-wrap: break-word;
word-break: break-all;
white-space: pre-wrap;
user-select: none;
font-size: 13px;
line-height: ${(props) => (props.$line ? props.$line : 23)}px;
color: ${(props) => (props.$color ? props.$color : "#333333")};
margin-right: 8px;
font-weight: ${(props) => (props.$hasChild ? "600" : "normal")};
&:hover {
cursor: pointer;
}
`;
interface ICollapseTitle {
lineHeight?: number;
color?: string;
label: string;
hasChild?: boolean;
style?: CSSProperties;
}
export const CollapseTitle = (props: ICollapseTitle) => {
const { color, label, lineHeight, hasChild } = props;
return (
<LeftTitle style={props.style} $color={color} $line={lineHeight} $hasChild={hasChild}>
{label}
</LeftTitle>
);
};
interface ICollapseLabel {
color?: string;
label: string;
}
export const CollapseLabel = (props: ICollapseLabel) => {
const { color, label } = props;
return (
<CollapseTitle color={color} label={label} style={{ userSelect: "text" }} lineHeight={21} />
);
};
export const CollapseLink = (props: ICollapseLabel) => {
const { color, label } = props;
return <CollapseTitle color={color} label={label} lineHeight={19} />;
};
export const CommonTextLabel = styled.p`
font-size: 13px;
color: #222222;
line-height: 13px;
margin: 0;
`;
export const CommonTextLabel2 = styled.p`
font-size: 14px;
color: #333333;
line-height: 14px;
margin: 0;
`;
export const CommonGrayLabel = styled.p`
font-size: 13px;
color: #8b8fa3;
line-height: 13px;
margin: 0;
`;
export const CommonErrorLabel = styled.p<{ $fontSize?: number }>`
font-size: ${(props) => (props.$fontSize ? props.$fontSize : 12)}px;
line-height: ${(props) => (props.$fontSize ? props.$fontSize : 12)}px;
color: #f73131;
margin: 0;
`;
export const CommonBlueLabel = styled.span`
${labelCss}
&:hover {
cursor: pointer;
}
font-size: 12px;
color: #4965f2;
margin-left: 4px;
`;