-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor package download link handling in PackageDetails component
- Simplified the construction of the download URL for packages. - Moved the URL generation logic directly into the onClick handler for better readability. - Ensured the download functionality remains intact while improving code clarity.
- Loading branch information
Showing
2 changed files
with
57 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,48 @@ | ||
import { GridShowcase, Input } from "@lobehub/ui"; | ||
import { Button } from 'antd'; | ||
import { useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
const Welcome = () => { | ||
const [search, setSearch] = useState(""); | ||
import React from 'react'; | ||
import { Button, Typography, Card } from 'antd'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
const { Title, Paragraph } = Typography; | ||
|
||
const WelcomePage = () => { | ||
const navigate = useNavigate(); | ||
|
||
return <> | ||
<GridShowcase style={{ width: '100%' }}> | ||
<div style={{ fontSize: 48, fontWeight: 600, marginTop: -16 }}> | ||
使用NuGet Next 更快创建 .NET 程序。</div> | ||
<div style={{ | ||
marginLeft: 'auto', | ||
marginRight: 'auto', | ||
width: 500, | ||
}}> | ||
<Input | ||
return ( | ||
<Flexbox | ||
style={{ | ||
height: '100vh', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#f0f2f5', | ||
padding: '20px', | ||
}} | ||
> | ||
<Card | ||
style={{ | ||
maxWidth: '600px', | ||
textAlign: 'center', | ||
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)', | ||
}} | ||
> | ||
<Title level={2}>欢迎来到 NuGet Next</Title> | ||
<Paragraph> | ||
这是一个现代化的NuGet包管理平台,提供快速、可靠的包上传和下载服务。 | ||
</Paragraph> | ||
<Paragraph> | ||
了解更多关于如何创建和管理NuGet包的信息,请访问我们的文档。 | ||
</Paragraph> | ||
<Button | ||
type="primary" | ||
size="large" | ||
value={search} | ||
onChange={(e) => setSearch(e.target.value)} | ||
suffix={<Button onClick={() => { | ||
var query = new URLSearchParams(); | ||
query.set('q', encodeURIComponent(search)); | ||
navigate(`/packages?${query}`); | ||
}} type="text">🔍</Button>} | ||
placeholder="搜索包..." /> | ||
</div> | ||
</GridShowcase> | ||
</>; | ||
} | ||
onClick={() => navigate('/upload')} | ||
style={{ marginTop: '20px' }} | ||
> | ||
开始上传 | ||
</Button> | ||
</Card> | ||
</Flexbox> | ||
); | ||
}; | ||
|
||
export default Welcome; | ||
export default WelcomePage; |