Skip to content

Commit 267987a

Browse files
committed
Add StatusBar.
1 parent 459e21b commit 267987a

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.status-bar {
2+
position: fixed;
3+
top: 0;
4+
left: 0;
5+
width: 100%;
6+
height: 10vh;
7+
min-height: 50px;
8+
background: linear-gradient(180deg, rgba(200, 220, 240, 0.85) 0%, rgba(180, 200, 230, 0.75) 100%);
9+
z-index: 8;
10+
display: flex;
11+
align-items: center;
12+
justify-content: center;
13+
pointer-events: none;
14+
user-select: none;
15+
}
16+
17+
.status-bar-content {
18+
color: #2c3e50;
19+
font-size: 3rem;
20+
font-weight: 500;
21+
text-align: center;
22+
padding: 0 20px;
23+
max-width: 100%;
24+
overflow: hidden;
25+
text-overflow: ellipsis;
26+
white-space: nowrap;
27+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useSelector } from 'react-redux';
2+
import { RootState } from '@/store/store';
3+
import './StatusBar.scss';
4+
5+
export function StatusBar() {
6+
const statusBarText = useSelector((state: RootState) => state.stage.statusBarText);
7+
const showTitle = useSelector((state: RootState) => state.GUI.showTitle);
8+
const showMenuPanel = useSelector((state: RootState) => state.GUI.showMenuPanel);
9+
const showExtra = useSelector((state: RootState) => state.GUI.showExtra);
10+
11+
// 在标题、菜单、鉴赏模式时不显示状态框
12+
if (showTitle || showMenuPanel || showExtra || !statusBarText) {
13+
return null;
14+
}
15+
16+
return (
17+
<div className="status-bar">
18+
<div className="status-bar-content">{statusBarText}</div>
19+
</div>
20+
);
21+
}

0 commit comments

Comments
 (0)