Skip to content

Commit 2629be3

Browse files
committed
修复返回首页报错
移动链接位置
1 parent 9d1ed3c commit 2629be3

File tree

7 files changed

+88
-15
lines changed

7 files changed

+88
-15
lines changed

src/App.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import Pictures from './components/Pictures';
1313
import Watermark from '@hi-ui/watermark';
1414
import BackToTop from './components/BackToTop';
1515
import { Helmet } from 'react-helmet';
16-
import ChangeLog from "./util/ChangeLog.jsx";
16+
import ChangeLog from './util/ChangeLog';
17+
import Coffee from './components/Coffee';
1718

1819
const App = () => {
1920
// semi-design的主题默认为暗色
@@ -83,6 +84,7 @@ const App = () => {
8384
<Route path="/urls" element={<Urls />} />
8485
<Route path="/pictures" element={<Pictures />} />
8586
<Route path="/changelog" element={<ChangeLog />} />
87+
<Route path="/coffee" element={<Coffee />} />
8688
<Route path="*" element={<NotFound />} />
8789
</Routes>
8890

src/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2025-01-24 移动链接位置
2+
3+
2025-01-24 修复返回首页报错
4+
15
2025-01-20 增加网站更新日志
26

37
2025-01-19 拆分工作经历组件,增加项目经验

src/components/AboutMe/Links.jsx

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import { motion } from 'framer-motion';
3+
import { Link } from 'react-router-dom';
4+
import { Typography } from '@douyinfe/semi-ui';
5+
// import { FaCoffee } from 'react-icons/fa';
6+
7+
const Links = () => {
8+
const { Paragraph } = Typography;
9+
10+
return (
11+
<motion.div
12+
className="dark:bg-gray-900 dark:text-gray-300 text-center mb-2"
13+
initial={{ opacity: 0, scale: 0.9 }}
14+
animate={{ opacity: 1, scale: 1 }}
15+
transition={{ duration: 0.3, delay: 0.5 }}>
16+
<h1 className="text-4xl font-bold mb-4">About Me</h1>
17+
<div className="flex items-center justify-center">
18+
<Paragraph
19+
copyable={{
20+
content: 'https://blog.tteam.icu/rss.xml',
21+
copyTip: 'copy',
22+
}}
23+
className="text-sm font-bold dark:hover:text-blue-400 transition-colors duration-200 cursor-pointer">
24+
Follow Me
25+
</Paragraph>
26+
<span className="mx-2">|</span>
27+
<Link
28+
to="/changelog"
29+
className="text-sm font-bold dark:hover:text-blue-400 transition-colors duration-200">
30+
Change Logs
31+
</Link>
32+
{/*<span className="mx-2">|</span>*/}
33+
{/*<Link*/}
34+
{/* to="/coffee"*/}
35+
{/* className="text-sm font-bold dark:hover:text-blue-400 transition-colors duration-200 flex items-center">*/}
36+
{/* <FaCoffee className="mr-1" />*/}
37+
{/* Buy Some Coffee*/}
38+
{/*</Link>*/}
39+
</div>
40+
</motion.div>
41+
);
42+
};
43+
44+
export default Links;

src/components/AboutMe/index.jsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import HeadPortrait from './HeadPortrait';
44
import LanguageSection from './LanguageSection';
55
import WorkExperience from './WorkExperience';
66
import { pageVariants } from '../../config';
7-
import OpenSourceProjects from './OpenSourceProjects.jsx';
7+
import OpenSourceProjects from './OpenSourceProjects';
8+
import Links from './Links';
89

910
const AboutMe = ({ wakatimeData }) => {
1011
return (
@@ -17,14 +18,7 @@ const AboutMe = ({ wakatimeData }) => {
1718
transition={{ duration: 0.5 }}>
1819
<HeadPortrait />
1920

20-
<motion.h1
21-
className="text-4xl font-bold mb-4"
22-
initial={{ opacity: 0, y: 50 }} // 从下方开始 (y 设为正值)
23-
animate={{ opacity: 1, y: 0 }} // 最终回到原始位置
24-
transition={{ duration: 1 }} // 动画持续 1 秒
25-
>
26-
About Me
27-
</motion.h1>
21+
<Links />
2822

2923
<LanguageSection
3024
start_time={wakatimeData.start_time}

src/components/Coffee/index.jsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import { motion } from 'framer-motion';
3+
import { pageVariants } from '../../config';
4+
import { Button } from '@douyinfe/semi-ui';
5+
import { IoIosArrowBack } from 'react-icons/io';
6+
import { useNavigate } from 'react-router-dom';
7+
8+
const Coffee = () => {
9+
const navigate = useNavigate();
10+
11+
return (
12+
<motion.div
13+
className="w-[80%] mx-auto min-h-screen dark:bg-gray-900 text-white flex flex-col items-center p-4 mt-3"
14+
variants={pageVariants}
15+
initial="initial"
16+
animate="animate"
17+
exit="exit"
18+
transition={{ duration: 0.5 }}>
19+
<div className="w-full flex justify-start text-white mb-10">
20+
<Button
21+
theme="outline"
22+
type="tertiary"
23+
onClick={() => navigate('/')}>
24+
<IoIosArrowBack />
25+
返回首页
26+
</Button>
27+
</div>
28+
</motion.div>
29+
);
30+
};
31+
32+
export default Coffee;

src/components/NavBar.jsx

-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ const NavBar = () => {
4040
className="items-center text-lg font-bold dark:hover:text-blue-400 transition-colors duration-200 hidden md:flex">
4141
Pictures
4242
</Link>
43-
<Link
44-
to="/changelog"
45-
className="items-center text-lg font-bold dark:hover:text-blue-400 transition-colors duration-200 hidden md:flex">
46-
ChangeLog
47-
</Link>
4843
<a
4944
href={skipUrl.note}
5045
target="_blank"

src/components/Pictures/index.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import {
77
IllustrationConstructionDark,
88
} from '@douyinfe/semi-illustrations';
99
import { IoIosArrowBack } from 'react-icons/io';
10+
import { useNavigate } from 'react-router-dom';
1011

1112
const Pictures = () => {
13+
const navigate = useNavigate();
1214
const [loadedPhotos, setLoadedPhotos] = useState([]);
1315
const [currentIndex, setCurrentIndex] = useState(0);
1416
const [pictureList, setPictureList] = useState({ urls: [], count: 0 });

0 commit comments

Comments
 (0)