Skip to content

Commit e1b494a

Browse files
committed
feat: 添加微信交流群悬浮球
1 parent 14d643d commit e1b494a

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

public/wechat-qr.png

328 KB
Loading

src/components/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import GraphView from './GraphView';
66
import DataStructuresPanel from './DataStructuresPanel';
77
import ControlPanel from './ControlPanel';
88
import ProgressBar from './ProgressBar';
9+
import WechatFloat from './WechatFloat';
910
import { usePlayback } from '../hooks/usePlayback';
1011
import { useKeyboardShortcuts } from '../hooks/useKeyboardShortcuts';
1112
import { generateSteps } from '../algorithm/stepGenerator';
@@ -155,6 +156,8 @@ function App() {
155156
totalSteps={steps.length}
156157
onSeek={goToStep}
157158
/>
159+
160+
<WechatFloat />
158161
</div>
159162
);
160163
}

src/components/WechatFloat.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.wechat-float {
2+
position: fixed;
3+
right: 20px;
4+
bottom: 50px;
5+
z-index: 200;
6+
}
7+
8+
.wechat-icon {
9+
width: 50px;
10+
height: 50px;
11+
background: #07c160;
12+
border-radius: 50%;
13+
display: flex;
14+
align-items: center;
15+
justify-content: center;
16+
font-size: 24px;
17+
cursor: pointer;
18+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
19+
transition: transform 0.2s, box-shadow 0.2s;
20+
}
21+
22+
.wechat-icon:hover {
23+
transform: scale(1.1);
24+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
25+
}
26+
27+
.wechat-popup {
28+
position: absolute;
29+
bottom: 60px;
30+
right: 0;
31+
background: #fff;
32+
border-radius: 12px;
33+
padding: 16px;
34+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
35+
text-align: center;
36+
min-width: 200px;
37+
}
38+
39+
.wechat-popup img {
40+
width: 180px;
41+
height: 180px;
42+
border-radius: 8px;
43+
}
44+
45+
.wechat-popup p {
46+
margin: 12px 0 0;
47+
color: #333;
48+
font-size: 14px;
49+
line-height: 1.5;
50+
}
51+
52+
.wechat-popup strong {
53+
color: #07c160;
54+
}

src/components/WechatFloat.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { useState } from 'react';
2+
import './WechatFloat.css';
3+
4+
export default function WechatFloat() {
5+
const [isHovered, setIsHovered] = useState(false);
6+
7+
return (
8+
<div
9+
className="wechat-float"
10+
onMouseEnter={() => setIsHovered(true)}
11+
onMouseLeave={() => setIsHovered(false)}
12+
>
13+
<div className="wechat-icon">💬</div>
14+
{isHovered && (
15+
<div className="wechat-popup">
16+
<img src="./wechat-qr.png" alt="微信二维码" />
17+
<p>扫码发送 <strong>leetcode</strong> 加入算法交流群</p>
18+
</div>
19+
)}
20+
</div>
21+
);
22+
}

0 commit comments

Comments
 (0)