Skip to content

Commit 11f0d4f

Browse files
committed
feat: Footer 相关组件及页面移动端适配
1 parent c042a13 commit 11f0d4f

File tree

7 files changed

+137
-116
lines changed

7 files changed

+137
-116
lines changed

src/components/DonatingCard/components/StickerButton.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export const StickerButton = ({ className }: { className?: string }) => {
2424
dark:!bg-gray-800 dark:text-gray-300 dark:shadow-lg dark:shadow-gray-700"
2525
>
2626
<div className="flex gap-2">
27-
<img src={sticker1} alt="alipay" className=" h-44 rounded shadow-lg shadow-gray-300 dark:shadow-gray-700" />
28-
<img src={sticker2} alt="alipay" className=" h-44 rounded shadow-lg shadow-gray-300 dark:shadow-gray-700" />
27+
<img src={sticker1} alt="sticker1" className="h-36 rounded shadow-lg shadow-gray-300 dark:shadow-gray-700" />
28+
<img src={sticker2} alt="sticker2" className="h-36 rounded shadow-lg shadow-gray-300 dark:shadow-gray-700" />
2929
</div>
30-
<span className="mt-3 text-xs font-bold text-gray-500">
31-
<IconInfo className="mb-[3px] mr-1 inline-block" />
32-
此贴纸非商品,仅用于感谢您的捐赠,不可用于任何商业用途
30+
<span className="mt-2 flex flex-col items-center justify-center text-xs font-bold text-gray-500 sm:flex-row">
31+
<IconInfo className="mb-[3px] mr-1" />
32+
<span>此贴纸非商品,仅用于感谢您的捐赠,不可用于任何商业用途</span>
3333
</span>
3434
</Tooltip>
3535
</>

src/components/DonatingCard/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export const DonatingCard = ({ className, onAmountChange }: { className?: string
2727

2828
<div className={`mt-3 flex w-full flex-col overflow-hidden px-11 transition-[height] duration-500 ${amount ? 'h-44' : 'h-0'}`}>
2929
{amount && (
30-
<div className="flex w-full justify-between">
31-
<img src={AmountImageMap[amount][0]} alt="alipay" className=" h-44" />
32-
<img src={AmountImageMap[amount][1]} alt="weChat" className=" h-44" />
30+
<div className="flex w-full justify-center gap-x-2">
31+
<img src={AmountImageMap[amount][0]} alt="alipay" className="h-40" />
32+
<img src={AmountImageMap[amount][1]} alt="weChat" className="h-40" />
3333
</div>
3434
)}
3535
</div>

src/components/Footer/index.tsx

+110-97
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ const Footer: React.FC = () => {
118118
<br />
119119
<p className="text-sm text-gray-500 dark:text-gray-400">再次感谢您的支持和关注!</p>
120120
<br />
121-
<img className="ml-1 w-2/6 " src="https://qwerty.kaiyi.cool/weChat-group.png" alt="weChat-group" />
121+
<div className="flex justify-center">
122+
<img className="ml-1 w-40 " src="https://qwerty.kaiyi.cool/weChat-group.png" alt="weChat-group" />
123+
</div>
122124
<br />
123125
</InfoPanel>
124126

@@ -142,108 +144,119 @@ const Footer: React.FC = () => {
142144
「Qwerty Learner」!
143145
</p>
144146
<br />
145-
<img className="ml-1 w-5/12 " src={redBookCode} alt="redBook" />
146-
<p className="text-sm text-gray-500 dark:text-gray-400">Tips: 从小红书“我”的左上角点击 三 找到 扫一扫</p>
147+
<div className="flex flex-col items-center justify-center">
148+
<img className="ml-1 w-40 " src={redBookCode} alt="redBook" />
149+
<p className="mt-2 text-sm text-gray-500 dark:text-gray-400">Tips: 从小红书“我”的左上角点击 三 找到 扫一扫</p>
150+
</div>
147151
<br />
148152
</InfoPanel>
149153

150-
<footer className="mb-1 mt-4 flex w-full items-center justify-center gap-2.5 text-sm ease-in" onClick={(e) => e.currentTarget.blur()}>
151-
<a href="https://github.com/Kaiyiwing/qwerty-learner" target="_blank" rel="noreferrer" aria-label="前往 GitHub 项目主页">
152-
<IconGithub fontSize={15} className="text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100" />
153-
</a>
154+
<footer
155+
className="fixed bottom-4 flex w-full flex-col items-center justify-center gap-4 text-sm ease-in sm:flex-row"
156+
onClick={(e) => e.currentTarget.blur()}
157+
>
158+
<div className="flex gap-3">
159+
<a href="https://github.com/Kaiyiwing/qwerty-learner" target="_blank" rel="noreferrer" aria-label="前往 GitHub 项目主页">
160+
<IconGithub fontSize={15} className="text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100" />
161+
</a>
154162

155-
<button
156-
className="cursor-pointer"
157-
type="button"
158-
onClick={(e) => {
159-
handleOpenInfoPanel('redBook')
160-
e.currentTarget.blur()
161-
}}
162-
aria-label="加入我们的小红书社群"
163-
>
164-
<IconXiaoHongShu fontSize={14} className="text-gray-500 hover:text-red-500 dark:text-gray-400 dark:hover:text-red-500" />
165-
</button>
166-
167-
<button
168-
className="cursor-pointer focus:outline-none"
169-
type="button"
170-
onClick={(e) => {
171-
handleOpenInfoPanel('community')
172-
e.currentTarget.blur()
173-
}}
174-
aria-label="加入我们的微信用户群"
175-
>
176-
<IconWechat2 fontSize={16} className="text-gray-500 hover:text-green-500 dark:text-gray-400 dark:hover:text-green-500" />
177-
</button>
178-
179-
<a href="https://twitter.com/real_kai42" target="_blank" title="x" rel="noreferrer">
180-
<IconTwitter fontSize={16} className="text-gray-500 hover:text-[#1DA1F2] dark:text-gray-400 dark:hover:text-[#1DA1F2]" />
181-
</a>
182-
<button
183-
className="cursor-pointer focus:outline-none "
184-
type="button"
185-
onClick={(e) => {
186-
handleOpenInfoPanel('donate')
187-
e.currentTarget.blur()
188-
}}
189-
aria-label="考虑捐赠我们"
190-
>
191-
<IconCoffee2 fontSize={16} className="text-gray-500 hover:text-amber-500 dark:text-gray-400 dark:hover:text-amber-500" />
192-
</button>
193-
194-
<button
195-
className="cursor-pointer focus:outline-none"
196-
type="button"
197-
onClick={(e) => {
198-
handleOpenInfoPanel('vsc')
199-
e.currentTarget.blur()
200-
}}
201-
aria-label="使用 Visual Studio Code 插件版 Qwerty Learner"
202-
>
203-
<IconVisualstudiocode fontSize={14} className="text-gray-500 hover:text-sky-500 dark:text-gray-400 dark:hover:text-sky-500" />
204-
</button>
205-
206-
<a
207-
href="mailto:[email protected]"
208-
target="_blank"
209-
rel="noreferrer"
210-
onClick={(e) => e.currentTarget.blur()}
211-
aria-label="发送邮件到 [email protected]"
212-
>
213-
<IconMail fontSize={16} className="text-gray-500 hover:text-indigo-400 dark:text-gray-400 dark:hover:text-indigo-400" />
214-
</a>
215-
<a rel="noreferrer" className="cursor-pointer focus:outline-none" onClick={() => navigate('/friend-links')} aria-label="查看友链">
216-
<RiLinksLine fontSize={14} className="text-gray-500 hover:text-indigo-400 dark:text-gray-400 dark:hover:text-indigo-400" />
217-
</a>
163+
<button
164+
className="cursor-pointer"
165+
type="button"
166+
onClick={(e) => {
167+
handleOpenInfoPanel('redBook')
168+
e.currentTarget.blur()
169+
}}
170+
aria-label="加入我们的小红书社群"
171+
>
172+
<IconXiaoHongShu fontSize={14} className="text-gray-500 hover:text-red-500 dark:text-gray-400 dark:hover:text-red-500" />
173+
</button>
218174

219-
<Tooltip content="中国大陆镜像">
220-
<a href="https://kaiyiwing.gitee.io/qwerty-learner" target="_self" title="前往中国大陆镜像">
221-
<IconFlagChina fontSize={16} />
175+
<button
176+
className="cursor-pointer focus:outline-none"
177+
type="button"
178+
onClick={(e) => {
179+
handleOpenInfoPanel('community')
180+
e.currentTarget.blur()
181+
}}
182+
aria-label="加入我们的微信用户群"
183+
>
184+
<IconWechat2 fontSize={16} className="text-gray-500 hover:text-green-500 dark:text-gray-400 dark:hover:text-green-500" />
185+
</button>
186+
187+
<a href="https://twitter.com/real_kai42" target="_blank" title="x" rel="noreferrer">
188+
<IconTwitter fontSize={16} className="text-gray-500 hover:text-[#1DA1F2] dark:text-gray-400 dark:hover:text-[#1DA1F2]" />
222189
</a>
223-
</Tooltip>
224-
225-
<button
226-
className="cursor-pointer text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
227-
type="button"
228-
onClick={(e) => {
229-
handleOpenInfoPanel('donate')
230-
e.currentTarget.blur()
231-
}}
232-
>
233-
@ Qwerty Learner
234-
</button>
235-
236-
<a
237-
className="cursor-pointer text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
238-
href="https://beian.miit.gov.cn"
239-
target="_blank"
240-
rel="noreferrer"
241-
>
242-
鲁ICP备2022030649号
243-
</a>
244-
<span className="select-none rounded bg-slate-200 px-1 text-xs text-slate-600 dark:bg-slate-800 dark:text-slate-400">
245-
Build <span className="select-all">{LATEST_COMMIT_HASH}</span>
246-
</span>
190+
<button
191+
className="cursor-pointer focus:outline-none "
192+
type="button"
193+
onClick={(e) => {
194+
handleOpenInfoPanel('donate')
195+
e.currentTarget.blur()
196+
}}
197+
aria-label="考虑捐赠我们"
198+
>
199+
<IconCoffee2 fontSize={16} className="text-gray-500 hover:text-amber-500 dark:text-gray-400 dark:hover:text-amber-500" />
200+
</button>
201+
202+
<button
203+
className="cursor-pointer focus:outline-none"
204+
type="button"
205+
onClick={(e) => {
206+
handleOpenInfoPanel('vsc')
207+
e.currentTarget.blur()
208+
}}
209+
aria-label="使用 Visual Studio Code 插件版 Qwerty Learner"
210+
>
211+
<IconVisualstudiocode fontSize={14} className="text-gray-500 hover:text-sky-500 dark:text-gray-400 dark:hover:text-sky-500" />
212+
</button>
213+
214+
<a
215+
href="mailto:[email protected]"
216+
target="_blank"
217+
rel="noreferrer"
218+
onClick={(e) => e.currentTarget.blur()}
219+
aria-label="发送邮件到 [email protected]"
220+
>
221+
<IconMail fontSize={16} className="text-gray-500 hover:text-indigo-400 dark:text-gray-400 dark:hover:text-indigo-400" />
222+
</a>
223+
<a rel="noreferrer" className="cursor-pointer focus:outline-none" onClick={() => navigate('/friend-links')} aria-label="查看友链">
224+
<RiLinksLine fontSize={14} className="text-gray-500 hover:text-indigo-400 dark:text-gray-400 dark:hover:text-indigo-400" />
225+
</a>
226+
227+
<Tooltip content="中国大陆镜像">
228+
<a href="https://kaiyiwing.gitee.io/qwerty-learner" target="_self" title="前往中国大陆镜像">
229+
<IconFlagChina fontSize={16} />
230+
</a>
231+
</Tooltip>
232+
</div>
233+
234+
<div className="flex flex-col items-center justify-center gap-x-2 gap-y-1 sm:flex-row">
235+
<div className="flex items-center gap-x-2">
236+
<button
237+
className="cursor-pointer text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
238+
type="button"
239+
onClick={(e) => {
240+
handleOpenInfoPanel('donate')
241+
e.currentTarget.blur()
242+
}}
243+
>
244+
@ Qwerty Learner
245+
</button>
246+
<span className="select-none rounded bg-slate-200 px-1 text-xs text-slate-600 dark:bg-slate-800 dark:text-slate-400">
247+
Build <span className="select-all">{LATEST_COMMIT_HASH}</span>
248+
</span>
249+
</div>
250+
251+
<a
252+
className="cursor-pointer text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
253+
href="https://beian.miit.gov.cn"
254+
target="_blank"
255+
rel="noreferrer"
256+
>
257+
鲁ICP备2022030649号
258+
</a>
259+
</div>
247260
</footer>
248261
</>
249262
)

src/components/Layout.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import Footer from './Footer'
21
import type React from 'react'
32

43
export default function Layout({ children }: { children: React.ReactNode }) {
5-
return (
6-
<main className="flex h-screen w-screen flex-col items-center overflow-hidden pb-4">
7-
{children}
8-
<Footer />
9-
</main>
10-
)
4+
return <main className="flex h-screen w-screen flex-col items-center overflow-hidden pb-4">{children}</main>
115
}

src/pages/FriendLinks/index.tsx

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ import ezbdc from '@/assets/friendlinks/ezbdc.jpg'
33
import kk from '@/assets/friendlinks/kk.jpg'
44
import web_worker from '@/assets/friendlinks/web-worker.png'
55
import type React from 'react'
6+
import { useNavigate } from 'react-router-dom'
7+
import IconX from '~icons/tabler/x'
68

79
export const FriendLinks: React.FC = () => {
10+
const navigate = useNavigate()
11+
812
const links = [
913
{
1014
title: 'ez背单词',
@@ -27,11 +31,19 @@ export const FriendLinks: React.FC = () => {
2731
},
2832
]
2933

34+
const onBack = () => {
35+
navigate('/')
36+
}
37+
3038
return (
3139
<Layout>
40+
<div className="fixed top-0 z-20 flex h-14 w-full flex-row-reverse items-center sm:h-16">
41+
<IconX className="mx-4 h-7 w-7 cursor-pointer text-gray-400 sm:mx-6" onClick={onBack} />
42+
</div>
43+
3244
<div className="flex w-full flex-1 flex-col items-center px-4 pt-20">
3345
<div className="flex w-full max-w-md flex-grow flex-col items-center">
34-
<div className="mt-5 text-center text-lg font-bold">友情链接</div>
46+
<h1 className="mt-5 text-center text-lg font-bold dark:text-white">友情链接</h1>
3547
<div className="links flex w-full flex-col items-center gap-y-8 py-5">
3648
{links.map((link, index) => (
3749
<a
@@ -42,11 +54,11 @@ export const FriendLinks: React.FC = () => {
4254
rel="noopener noreferrer"
4355
className="linkItem flex w-full items-center overflow-hidden"
4456
>
45-
<div className="mr-3 flex h-8 w-8 flex-shrink-0 items-center justify-center bg-gray-200">
57+
<div className="mr-4 flex h-16 w-16 flex-shrink-0 items-center justify-center rounded border bg-gray-200">
4658
<img src={link.imgSrc} alt={link.title} className="h-full w-full object-cover" />
4759
</div>
4860
<div className="flex-1">
49-
<div className="pb-1 text-sm font-bold">{link.title}</div>
61+
<div className="pb-1 text-sm font-bold dark:text-white">{link.title}</div>
5062
<div className="text-xs text-gray-500">{link.description}</div>
5163
</div>
5264
</a>

src/pages/Typing/components/Speed/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function Speed() {
1212
const inputNumber = state.chapterData.correctCount + state.chapterData.wrongCount
1313

1414
return (
15-
<div className="flex w-full justify-center px-8">
15+
<div className="flex w-full justify-center px-8 pb-4">
1616
<div className="my-card flex w-80 rounded-xl bg-white p-4 opacity-50 transition-colors duration-300 dark:bg-gray-800 sm:w-85 lg:w-100">
1717
<InfoBox info={`${minutesString}:${secondsString}`} description="时间" />
1818
<InfoBox info={inputNumber + ''} description="输入数" />

src/pages/Typing/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useConfetti } from './hooks/useConfetti'
1111
import { useWordList } from './hooks/useWordList'
1212
import { TypingContext, TypingStateActionType, initialState, typingReducer } from './store'
1313
import { DonateCard } from '@/components/DonateCard'
14+
import Footer from '@/components/Footer'
1415
import Header from '@/components/Header'
1516
import StarCard from '@/components/StarCard'
1617
import Tooltip from '@/components/Tooltip'
@@ -155,6 +156,7 @@ const App: React.FC = () => {
155156
<Speed />
156157
</div>
157158
</div>
159+
<Footer />
158160
</Layout>
159161
<WordList />
160162
</TypingContext.Provider>

0 commit comments

Comments
 (0)