Skip to content

Commit ba8da45

Browse files
committed
feat: new ui
1 parent e8c6822 commit ba8da45

19 files changed

+9671
-3752
lines changed

components/AppFooter.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { useTranslation } from 'next-i18next'
2+
import Image from 'next/image'
3+
import Link from 'next/link'
4+
import { useRouter } from 'next/router'
5+
import Container from './Container'
6+
import GithubSvg from '../public/images/nav/github.svg'
7+
import HeartSvg from '../public/images/nav/heart.svg'
8+
9+
const AppFooter = (props) => {
10+
const { t } = useTranslation('common')
11+
const router = useRouter()
12+
const docsLocale = router.locale == 'zh-CN' ? '/zh/' : ''
13+
return (
14+
<footer className="py-20 md:py-40">
15+
<Container>
16+
<div className="m-auto md:w-10/12 lg:w-8/12 xl:w-6/12">
17+
<div className="flex flex-wrap items-center justify-between md:flex-nowrap">
18+
<div className="flex w-full justify-center space-x-12 text-gray-600 dark:text-gray-300 sm:w-7/12 md:justify-start">
19+
<ul className="list-inside list-disc space-y-8">
20+
<li>
21+
<Link href="/" className="transition hover:text-primary">
22+
{t('home')}
23+
</Link>
24+
</li>
25+
<li>
26+
<Link href={`https://docs.gopeed.com${docsLocale}`} className="transition hover:text-primary">
27+
{t('docs')}
28+
</Link>
29+
</li>
30+
<li>
31+
<a href="mailto:liwei8466-qq.com" className="transition hover:text-primary">
32+
{t('contact')}
33+
</a>
34+
</li>
35+
</ul>
36+
37+
<ul role="list" className="space-y-8">
38+
<li>
39+
<Link href="https://github.com/GopeedLab/gopeed" className="flex items-center space-x-3 transition hover:text-primary">
40+
<GithubSvg className="w-5" />
41+
<span>Github</span>
42+
</Link>
43+
</li>
44+
<li>
45+
<a href="https://discord.gg/ZUJqJrwCGB" className="flex items-center space-x-3 transition hover:text-primary">
46+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" fill="currentColor" className="w-5">
47+
<path d="M25.12 6.946c-2.424-1.948-6.257-2.278-6.419-2.292a.608.608 0 0 0-.604.357c-.004.008-.218.629-.425 1.228 2.817.493 4.731 1.587 4.833 1.647A.999.999 0 0 1 22 9.75a.99.99 0 0 1-.501-.135C21.471 9.598 18.663 8 15.002 8 11.34 8 8.531 9.599 8.503 9.615a1 1 0 0 1-1.006-1.729c.102-.06 2.023-1.158 4.848-1.65-.218-.606-.438-1.217-.442-1.225a.6.6 0 0 0-.604-.357c-.162.013-3.995.343-6.451 2.318C3.564 8.158 1 15.092 1 21.087a.6.6 0 0 0 .08.301c1.771 3.11 6.599 3.924 7.699 3.959a.61.61 0 0 0 .511-.249l1.19-1.612c-2.61-.629-3.99-1.618-4.073-1.679a1 1 0 0 1 1.181-1.614C7.625 20.217 10.172 22 15 22c4.847 0 7.387-1.79 7.412-1.808a1.001 1.001 0 0 1 1.183 1.613c-.083.061-1.456 1.048-4.06 1.677l1.175 1.615c.115.158.298.25.492.25l.019-.001c1.101-.035 5.929-.849 7.699-3.959a.6.6 0 0 0 .08-.301c0-5.994-2.564-12.928-3.88-14.14zM11 19c-1.105 0-2-1.119-2-2.5s.895-2.5 2-2.5 2 1.119 2 2.5-.895 2.5-2 2.5zm8 0c-1.105 0-2-1.119-2-2.5s.895-2.5 2-2.5 2 1.119 2 2.5-.895 2.5-2 2.5z"></path>
48+
</svg>
49+
<span>Discord</span>
50+
</a>
51+
</li>
52+
<Link
53+
href="https://github.com/GopeedLab/gopeed/blob/main/.donate/index.md#donate"
54+
className="flex items-center space-x-3 transition hover:text-primary"
55+
>
56+
<HeartSvg className="w-5" />
57+
<span>{t('donate')}</span>
58+
</Link>
59+
</ul>
60+
</div>
61+
<div className="m-auto mt-16 w-10/12 space-y-6 text-center sm:mt-auto sm:w-5/12 sm:text-left">
62+
<span className="block text-gray-500 dark:text-gray-400">Copyright &copy; {new Date().getFullYear()} - Gopeed</span>
63+
</div>
64+
</div>
65+
</div>
66+
</Container>
67+
</footer>
68+
)
69+
}
70+
71+
export default AppFooter

components/AppHeader.css

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#header:has(#toggle_nav:checked) #hamburger #line {
2+
@apply rotate-45 translate-y-1.5
3+
}
4+
5+
#header:has(#toggle_nav:checked) #hamburger #line2 {
6+
@apply -rotate-45 -translate-y-1
7+
}

components/AppHeader.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { useTranslation } from 'next-i18next'
2+
import Image from 'next/image'
3+
import Link from 'next/link'
4+
import { useRouter } from 'next/router'
5+
import GithubSvg from '../public/images/nav/github.svg'
6+
import Container from './Container'
7+
import Translate from './Translate'
8+
9+
const AppHeader = (props) => {
10+
const { t } = useTranslation('common')
11+
const router = useRouter()
12+
const docsLocale = router.locale == 'zh-CN' ? '/zh/' : ''
13+
return (
14+
<header>
15+
<nav className="z-10 w-full absolute">
16+
<Container>
17+
<div className="flex flex-wrap items-center justify-between py-2 gap-6 md:py-4 md:gap-0 relative" id="header">
18+
<div className="relative z-20 flex w-full justify-between lg:w-max md:px-0">
19+
<a href="#home" aria-label="logo" className="flex space-x-2 items-center">
20+
<div aria-hidden="true" className="flex space-x-1">
21+
<Image src="/images/logo.png" alt="logo" width="32" height="32" />
22+
</div>
23+
<span className="text-2xl font-bold text-gray-900 dark:text-white">Gopeed</span>
24+
</a>
25+
26+
<div className="relative flex items-center lg:hidden max-h-10">
27+
<label role="button" htmlFor="toggle_nav" aria-label="humburger" id="hamburger" className="relative p-6 -mr-6">
28+
<div aria-hidden="true" id="line" className="m-auto h-0.5 w-5 rounded bg-sky-900 dark:bg-gray-300 transition duration-300"></div>
29+
<div aria-hidden="true" id="line2" className="m-auto mt-2 h-0.5 w-5 rounded bg-sky-900 dark:bg-gray-300 transition duration-300"></div>
30+
</label>
31+
</div>
32+
</div>
33+
34+
<div className="flex justify-end">
35+
<input aria-hidden="true" type="checkbox" name="toggle_nav" id="toggle_nav" className="hidden peer" />
36+
<div
37+
aria-hidden="true"
38+
className="fixed z-10 inset-0 h-screen w-screen bg-white/70 backdrop-blur-2xl origin-bottom scale-y-0 transition duration-500 peer-checked:origin-top peer-checked:scale-y-100 lg:hidden dark:bg-gray-900/70"
39+
></div>
40+
<div
41+
className="flex-col z-20 flex-wrap gap-6 p-8 rounded-3xl border border-gray-100 bg-white shadow-2xl shadow-gray-600/10 justify-end w-full invisible opacity-0 translate-y-1 absolute top-full left-0 transition-all duration-300 scale-95 origin-top
42+
lg:relative lg:scale-100 lg:peer-checked:translate-y-0 lg:translate-y-0 lg:flex lg:flex-row lg:items-center lg:gap-0 lg:p-0 lg:bg-transparent lg:w-7/12 lg:visible lg:opacity-100 lg:border-none
43+
peer-checked:scale-100 peer-checked:opacity-100 peer-checked:visible lg:shadow-none
44+
dark:shadow-none dark:border-gray-700"
45+
>
46+
<div className="text-gray-600 dark:text-gray-300 lg:pr-2 lg:w-auto w-full lg:pt-0">
47+
<ul className="tracking-wide font-medium lg:font-bold lg:text-sm flex-col flex lg:flex-row gap-6 lg:gap-0 lg:border-r dark:lg:border-white/30">
48+
<li>
49+
<Link href={`https://docs.gopeed.com${docsLocale}`} className="block md:px-4 transition hover:text-primary">
50+
<span>{t('docs')}</span>
51+
</Link>
52+
</li>
53+
<li>
54+
<Link
55+
href="https://github.com/GopeedLab/gopeed/blob/main/.donate/index.md#donate"
56+
className="block md:px-4 transition hover:text-primary"
57+
>
58+
<span>{t('donate')}</span>
59+
</Link>
60+
</li>
61+
</ul>
62+
</div>
63+
</div>
64+
<div className="absolute z-30 right-[2rem] top-[0.7rem] gap-4 md:right-24 lg:relative lg:left-0 lg:top-0">
65+
<div className="flex justify-between">
66+
<Translate />
67+
<a
68+
href="https://github.com/GopeedLab/gopeed"
69+
className="group relative flex h-9 w-9 rounded-full transition hover:bg-blue-950/5 dark:hover:bg-white/10"
70+
>
71+
<GithubSvg className="m-auto h-5 w-5 fill-gray-500 group-hover:fill-gray-950 dark:fill-white/70 dark:group-hover:fill-white" />
72+
</a>
73+
</div>
74+
</div>
75+
</div>
76+
</div>
77+
</Container>
78+
</nav>
79+
</header>
80+
)
81+
}
82+
83+
export default AppHeader

components/Container.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Container = (props) => {
2+
const { children } = props
3+
return <div className="max-w-7xl mx-auto px-6 md:px-12 xl:px-6">{children}</div>
4+
}
5+
6+
export default Container

components/Header.js

-88
This file was deleted.

components/HeroSection.js

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { useTranslation } from 'next-i18next'
2+
import Image from 'next/image'
3+
import Container from './Container'
4+
import Link from 'next/link'
5+
import UAParser from 'ua-parser-js'
6+
import androidSvg from '../public/images/platform/android.svg'
7+
import linuxSvg from '../public/images/platform/linux.svg'
8+
import macosSvg from '../public/images/platform/macos.svg'
9+
import windowsSvg from '../public/images/platform/windows.svg'
10+
import { useEffect, useState } from 'react'
11+
12+
const HeroSection = ({ release }) => {
13+
const [downloadUrl, setDownloadUrl] = useState('')
14+
useEffect(() => {
15+
const parser = new UAParser()
16+
const os = parser.getOS().name
17+
const ua = {
18+
arch: parser.getCPU().architecture,
19+
}
20+
if (os.includes('Windows')) {
21+
ua.os = 'windows'
22+
}
23+
if (os.includes('Mac')) {
24+
ua.os = 'macos'
25+
}
26+
if (os.includes('Linux')) {
27+
ua.os = 'linux'
28+
}
29+
if (os.includes('Android')) {
30+
ua.os = 'android'
31+
}
32+
33+
const osAssert = release.assert[ua.os]
34+
// first match os and arch
35+
if (osAssert?.[ua.arch]) {
36+
setDownloadUrl(osAssert[ua.arch])
37+
return
38+
}
39+
// second match os
40+
if (osAssert) {
41+
setDownloadUrl(osAssert[Object.keys(osAssert)[0]])
42+
return
43+
}
44+
// no match, fallback to github latest release
45+
setDownloadUrl('https://github.com/GopeedLab/gopeed/releases/latest')
46+
}, [release.assert])
47+
48+
const { t } = useTranslation('common')
49+
return (
50+
<div className="relative" id="home">
51+
<div className="absolute inset-x-0 top-32 lg:hidden">
52+
<div aria-hidden="true" className="grid grid-cols-2 -space-x-52 opacity-50 dark:opacity-60 2xl:mx-auto 2xl:max-w-6xl">
53+
<div className="h-60 bg-gradient-to-br from-primary to-purple-400 blur-3xl dark:from-blue-700"></div>
54+
<div className="h-72 rounded-full bg-gradient-to-r from-cyan-400 to-sky-300 blur-3xl dark:from-transparent dark:to-indigo-600"></div>
55+
</div>
56+
</div>
57+
<Container>
58+
<div className="relative pt-36 ml-auto">
59+
<div className="gap-12 md:flex md:items-center">
60+
<div className="text-center sm:px-12 md:w-2/3 md:px-0 md:text-left lg:w-1/2">
61+
<h1 className="text-3xl font-black dark:text-white lg:text-5xl">{t('home.title')}</h1>
62+
<div>
63+
<p className="mt-8 text-lg text-gray-700 dark:text-gray-100">{t('home.desc')}</p>
64+
<div className="mt-12 flex justify-center gap-4 sm:gap-6 md:justify-start">
65+
<Link
66+
href={downloadUrl}
67+
className="relative flex h-12 w-full items-center justify-center px-6 before:absolute before:inset-0 before:rounded-lg before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max"
68+
>
69+
<span className="relative text-base font-semibold text-white normal-case">{t('download')}</span>
70+
</Link>
71+
<Link
72+
href="https://github.com/GopeedLab/gopeed/releases/latest"
73+
className="relative flex h-12 w-full items-center justify-center px-6 before:absolute before:inset-0 before:rounded-lg before:border before:border-transparent before:bg-primary/10 before:bg-gradient-to-b before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 dark:before:border-gray-800 dark:before:bg-gray-900 sm:w-max"
74+
>
75+
<span className="relative text-base font-semibold text-primary dark:text-white">{t('downloadMore')}</span>
76+
</Link>
77+
</div>
78+
</div>
79+
</div>
80+
<div className="relative mt-20 md:mt-0 md:w-2/5 lg:w-3/5">
81+
<div className="md:-mr-72 lg:mr-0">
82+
<Image className="h-full object-cover" priority src="/images/ui.png" alt="screenshot" width="1628" height="1233" />
83+
</div>
84+
</div>
85+
</div>
86+
<div className="hidden py-8 mt-16 border-y border-gray-100 dark:border-gray-800 sm:flex justify-between">
87+
<div className="text-left">
88+
<h6 className="text-lg font-semibold text-gray-700 dark:text-white">{t('home.feat1.title')}</h6>
89+
<p className="mt-2 text-gray-500">{t('home.feat1.desc')}</p>
90+
</div>
91+
<div className="text-left">
92+
<h6 className="text-lg font-semibold text-gray-700 dark:text-white">{t('home.feat2.title')}</h6>
93+
<p className="mt-2 text-gray-500">{t('home.feat2.desc')}</p>
94+
</div>
95+
<div className="text-left">
96+
<h6 className="text-lg font-semibold text-gray-700 dark:text-white">{t('home.feat3.title')}</h6>
97+
<p className="mt-2 text-gray-500">{t('home.feat3.desc')}</p>
98+
</div>
99+
</div>
100+
</div>
101+
</Container>
102+
</div>
103+
)
104+
}
105+
106+
export default HeroSection

0 commit comments

Comments
 (0)