-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathTitle.tsx
117 lines (107 loc) · 2.62 KB
/
Title.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
import { FC, ReactNode } from 'react'
import styled from 'styled-components/macro'
import { ToolTip } from '@/components/ToolTip'
const HelpIcon = styled.span`
position: relative;
cursor: pointer;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 1;
top: 1px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
&::before {
content: '\\e085';
}
`
const Content = styled.div`
color: #fff;
text-align: center;
white-space: nowrap;
`
const Help = ({ content }: { content: string | ReactNode }) => {
return (
<ToolTip
placement="left"
arrow={false}
keep={true}
title={<Content>{content}</Content>}
offset={{ left: 70, top: 40 }}
>
<HelpIcon />
</ToolTip>
)
}
interface TitleProps {
showOldRating: boolean
showPredictordelta: boolean
showNewRating: boolean
showExpectingRanking: boolean
realTime: boolean
help?: string | ReactNode
}
const Title: FC<TitleProps> = ({
showNewRating,
showPredictordelta,
showOldRating,
showExpectingRanking,
realTime,
help,
}) => {
return (
<>
<div
style={{
display: 'flex',
}}
>
{showOldRating && (
<div style={{ width: 60 }}>
旧分数
{!showPredictordelta && !showNewRating && help && (
<Help content={help} />
)}
</div>
)}
{showPredictordelta && (
<div
style={{
width: 55,
paddingLeft: showNewRating ? 10 : 0,
}}
>
<span>{showNewRating ? 'Δ' : '预测'}</span>
{!showNewRating && help && <Help content={help} />}
</div>
)}
{showNewRating && (
<div style={{ width: 70 }}>
新分数
{help && <Help content={help} />}
</div>
)}
{showExpectingRanking && realTime && (
<div>
<span>Rk/Exp</span>
<Help
content={
<div>
<div>当前全球排名(Rk)/期望全球排名(Exp)</div>
<div>
榜单数据更新有延迟,对于还不确定的「当前全球排名」标记为
<span style={{ color: '#bbb' }}>灰色</span>
,如果已经确定,则标记为
<span style={{ color: '#000' }}>黑色</span>
</div>
</div>
}
/>
</div>
)}
</div>
</>
)
}
export default Title