Skip to content

Commit e333d81

Browse files
committed
添加GitHub徽标到页面右上角
- 创建GitHubIcon组件,使用GitHub官方SVG图标 - 在CurlFilter组件header区域添加GitHub徽标按钮 - 点击徽标在新页面打开仓库地址 https://github.com/JSREI/curl-filter - 添加相应的CSS样式,包括hover效果和定位 - 修复TypeScript类型导入问题 - 通过Playwright测试验证界面效果
1 parent f8df656 commit e333d81

File tree

3 files changed

+64
-8
lines changed

3 files changed

+64
-8
lines changed

src/components/CurlFilter.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,34 @@
2020

2121
/* 标题区域 */
2222
.header-section {
23-
text-align: center;
2423
margin-bottom: 24px;
2524
}
2625

26+
.header-content {
27+
display: flex;
28+
justify-content: space-between;
29+
align-items: flex-start;
30+
position: relative;
31+
}
32+
33+
.header-text {
34+
flex: 1;
35+
text-align: center;
36+
}
37+
38+
.github-button {
39+
position: absolute;
40+
top: 0;
41+
right: 0;
42+
color: #00a86b !important;
43+
transition: all 0.3s ease;
44+
}
45+
46+
.github-button:hover {
47+
background-color: rgba(0, 168, 107, 0.08) !important;
48+
transform: scale(1.1);
49+
}
50+
2751
.header-actions {
2852
display: flex;
2953
gap: 12px;

src/components/CurlFilter.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
Preview as PreviewIcon,
2727
History as HistoryIcon
2828
} from '@mui/icons-material';
29+
import GitHubIcon from './GitHubIcon';
2930
import { parseCurl } from '../utils/curlParser';
3031
import { FilterEngine } from '../utils/filterEngine';
3132
import type { FilterRule, FilterContext, FilterResult } from '../types/filterRules';
@@ -286,13 +287,27 @@ const CurlFilter: React.FC = () => {
286287
<Box className="curl-filter-container">
287288
<Paper elevation={3} className="curl-filter-paper">
288289
<Box className="header-section">
289-
<Typography variant="h4" component="h1" className="title">
290-
<FilterList className="title-icon" />
291-
cURL 过滤器
292-
</Typography>
293-
<Typography variant="body1" color="text.secondary" className="subtitle">
294-
使用可配置的规则过滤cURL命令,支持请求头、查询参数、表单数据和JSON请求体
295-
</Typography>
290+
<Box className="header-content">
291+
<Box className="header-text">
292+
<Typography variant="h4" component="h1" className="title">
293+
<FilterList className="title-icon" />
294+
cURL 过滤器
295+
</Typography>
296+
<Typography variant="body1" color="text.secondary" className="subtitle">
297+
使用可配置的规则过滤cURL命令,支持请求头、查询参数、表单数据和JSON请求体
298+
</Typography>
299+
</Box>
300+
<Tooltip title="查看源代码">
301+
<IconButton
302+
onClick={() => window.open('https://github.com/JSREI/curl-filter', '_blank')}
303+
color="primary"
304+
className="github-button"
305+
size="large"
306+
>
307+
<GitHubIcon />
308+
</IconButton>
309+
</Tooltip>
310+
</Box>
296311

297312
<Box className="header-actions">
298313
<Button

src/components/GitHubIcon.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import { SvgIcon } from '@mui/material';
3+
import type { SvgIconProps } from '@mui/material';
4+
5+
/**
6+
* GitHub图标组件
7+
* 使用GitHub官方的SVG图标
8+
*/
9+
const GitHubIcon: React.FC<SvgIconProps> = (props) => {
10+
return (
11+
<SvgIcon {...props} viewBox="0 0 24 24">
12+
<path d="M12 0C5.374 0 0 5.373 0 12 0 17.302 3.438 21.8 8.207 23.387c.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"/>
13+
</SvgIcon>
14+
);
15+
};
16+
17+
export default GitHubIcon;

0 commit comments

Comments
 (0)