Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 添加友情链接 #25

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont need

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Codegeex.RepoIndex": true
}
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
}
```

---

如需增加`friends`页的成员

请在`src/assets/friends.json`

按照以下格式新增
```
{
"name": "",
"description": "",
"avatar": "",
"link" : ""
}
```


---

> 本项目使用了**ViewTransition**特性,所以请使用Astro ^4.12.2
Expand All @@ -68,6 +85,7 @@
│ └── wx.svg
├── src
│ ├── assets
│ │ ├── friends.json
│ │ └── memberList.json
│ ├── pages
│ │ ├── components
Expand All @@ -77,9 +95,13 @@
│ │ ├── layouts
│ │ │ ├── BaseLayout.astro
│ │ │ └── BaseMarkdownLayout.astro
│ │ ├── award.md
│ │ ├── index.md
│ │ ├── award.md
│ │ ├── friends.astro
│ │ └── member.astro
│ │
│ ├── scripts
│ │ └── menu.js
│ ├── styles
│ │ └── global.css
│ └── env.d.ts
Expand Down Expand Up @@ -111,6 +133,11 @@

结构请参考 [维护提示](#维护提示)

`friends.json` 为 friends.astro所引用的友链列表JSON

结构请参考 [维护提示](#维护提示)


### pages

`Astro`将渲染在本文件夹下的文件为页面
Expand All @@ -137,6 +164,10 @@ BaseMarkdownLayout为`index.md`和`award.md`的渲染模板

本文件夹下存放的`global.css`暂未实装

### scripts

本文件夹下存放的`menu.js`为`Navbar`组件的脚本

## 根目录

### package.json
Expand Down
8 changes: 8 additions & 0 deletions src/assets/friends.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "图书馆五楼风很大",
"description": "西安邮电大学智邮普创工作室",
"avatar": "http://ctf.zypc.online:30000/images/logo4.png",
"link" : "http://ctf.zypc.online:30000"
}
]
5 changes: 3 additions & 2 deletions src/assets/memberList.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@
"LiManJin",
"DkingL",
"zyq",
"heshuai",
"h4shu@1",
"zt"
],
"link": {
"Yalois": "https://blog.sky233.top",
"heiyu": "http://118.178.131.100",
"ink": "https://www.cnblogs.com/ink7",
"fffpppp": "https://www.cnblogs.com/fupo1",
"zt": "http://47.121.195.89/wordpress/"
"zt": "https://ztusers.github.io/",
"uuuwind": "https://www.cnblogs.com/uuuwindwowo"
}
}
}
9 changes: 2 additions & 7 deletions src/pages/award.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ currentPath: "/award"
.content ul, .content li {
list-style-type: square;font-size: 17px;line-height: 20px;
margin-bottom: 0.6em ;
}

img {
max-width: 100%;
height: auto;
}
}

</style>



# 荣誉
仅为部分奖项
![award](</award_1.jpg>)
<img src="/award_1.jpg" class="award" style="max-width: 100%; height: auto;">

## 2022
- XCTF第五期个人认证第9名
Expand Down
4 changes: 2 additions & 2 deletions src/pages/components/NavItem.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// 接受导航项的属性
const { label, href, isActive } = Astro.props;
---
<li>
<li onclick="switchMenu()">
<a href={href} class={`nav-link ${isActive ? 'active' : ''}`}>{label}</a>
</li>

Expand Down Expand Up @@ -52,7 +52,7 @@ const { label, href, isActive } = Astro.props;

@media (max-width: 768px) {
.nav-link {
padding: 10px 20px;
padding: 10px 20px;
}
}
</style>
82 changes: 77 additions & 5 deletions src/pages/components/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import { ViewTransitions } from 'astro:transitions';
import '@fontsource-variable/overpass-mono';
import '@fontsource-variable/noto-sans-sc';
import Footer from './Footer.astro';

// 导航项数据,可以从API或文件中读取
const navItems = [
{ label: '关于 About', href: '/' },
{ label: '成员 Members', href: '/member' },
{ label: '奖项 Awards', href: '/award' },
{ label: '友链 Friends', href: '/friends' },
];

const { currentPath } = Astro.props;
const showName = '齐鲁师范网络安全社团';
---

<nav class="navbar">
<div class="logo-container">
<a href="https://www.qlnu-sec.cn/">
Expand All @@ -24,16 +26,43 @@ const showName = '齐鲁师范网络安全社团';
<div class="show-name">
{showName}
</div>
<ul>
<ul id="menu">
{navItems.map(item => (
<NavItem label={item.label} href={item.href} isActive={item.href === currentPath} />
))}

</ul>

<ViewTransitions />
<div class="hamburger" onclick="switchMenu()">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</div>
</nav>
<ViewTransitions />

<ul class="nav2 hidetag">
{navItems.map(item => (
<NavItem label={item.label} href={item.href} isActive={item.href === currentPath} />
))}
</ul>
<style>
.nav2{
display: none;
}
.hamburger {
display: none;
position: absolute;
right: 20px;
cursor: pointer;
}

.hamburger .line {
display: block;
width: 30px;
height: 4px;
margin-bottom: 5px;
background-color: #000000;
}

.navbar {
font-family: 'Noto Sans SC Variable', sans-serif;
width: 180px;
Expand Down Expand Up @@ -155,4 +184,47 @@ const showName = '齐鲁师范网络安全社团';
font-family: 'Overpass Mono Variable', monospace;
}
}
@media (max-width: 500px) {
.show-name {
margin-top: 10px;
display: block;
text-align: center;
font-size: 20px;
margin-bottom: 20px;
}
.nav2{
border-radius: 10px;
width: 150px;
display: flex;
background-color: rgba(255, 255, 255, 0.8);
list-style-type: none;
padding: 3px;
margin: 0;
flex-direction: column;
position: absolute;
top: 80px;
right: 0;
margin-right: 8px;
}
.hidetag
{
display: none;
}
.hamburger {
display: block;
}
.navbar ul {
display: none;
}
.logo {
width: 40px;
height: 4%;
margin-bottom: 0;
margin-left: 20px;
margin-right: 10px;
}

}


</style>
80 changes: 80 additions & 0 deletions src/pages/friends.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
// 导入基础布局
import BaseLayout from './layouts/BaseLayout.astro';
import friendList from '../assets/friends.json';

---

<BaseLayout title="友链 Friends" currentPath="/friends">
<h1>友情链接</h1>
<p>友情直达~!!</p>
<div class="friend-list">
{friendList.map(friend => (
<div class="friend-link">
<div class="avatar">
<img src={friend.avatar} alt="头像" />
</div>
<div class="info">
<div class="name">{friend.name}</div>
<div class="description">{friend.description}</div>
</div>
<a href={friend.link} class="button">访问</a>
</div>
))}
</div>


<style>
.friend-link {
display: flex;
align-items: center;
padding: 10px;
border: 1px solid #ddd;
border-radius: 8px;
margin: 10px 0;
background-color: #f9f9f9;
margin-bottom: 60%;
}

.avatar {
border-radius: 50%;
overflow: hidden;
width: 50px;
height: 50px;
margin-right: 10px;
}

.avatar img {
width: 100%;
height: auto;
}

.info {
flex-grow: 1;
}

.name {
font-size: 16px;
font-weight: bold;
}

.description {
font-size: 14px;
color: #666;
}

.button {
text-decoration: none;
background-color: #4b4e52;
color: white;
padding: 8px 12px;
border-radius: 5px;
transition: background-color 0.3s;
}

.button:hover {
background-color: #000000;
}

</style>
</BaseLayout>
1 change: 1 addition & 0 deletions src/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ currentPath: '/'
}

</style>

# 关于我们

“齐鲁师范网络安全社团”(QLNU-Sec-Team)是一个由学生自发组建的组织,主要面向全校各年级对网络安全技术感兴趣的同学。
Expand Down
2 changes: 1 addition & 1 deletion src/pages/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const imageUrl = 'https://www.qlnu-sec.cn/icon.png'; // Replace with your actual
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{pageTitle}</title>
<link rel="icon" type="image/png" href="/icon.png">

<!-- SEO Meta Tags -->
<meta name="description" content={pageDescription}>
<meta name="keywords" content="cybersecurity, QLNU, security team, CTF, information security">
Expand Down Expand Up @@ -75,5 +74,6 @@ const imageUrl = 'https://www.qlnu-sec.cn/icon.png'; // Replace with your actual

}
</style>
<script is:inline src="/src/scripts/menu.js"></script>
</body>
</html>
5 changes: 2 additions & 3 deletions src/pages/layouts/BaseMarkdownLayout.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
import Footer from '../components/Footer.astro';
import Navbar from '../components/Navbar.astro';

const { frontmatter } = Astro.props;
const siteName = 'QLNU-Sec-Team';
const pageTitle = frontmatter?.title ? `${siteName} - ${frontmatter.title}` : siteName;
Expand All @@ -16,7 +15,7 @@ const imageUrl = 'https://www.qlnu-sec.cn/icon.png'; // Replace with your actual
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{pageTitle}</title>
<link rel="icon" type="image/png" href="/icon.png">

<!-- SEO Meta Tags -->
<meta name="description" content={pageDescription}>
<meta name="keywords" content="cybersecurity, QLNU, security team, CTF, information security">
Expand Down Expand Up @@ -72,6 +71,6 @@ const imageUrl = 'https://www.qlnu-sec.cn/icon.png'; // Replace with your actual

}
</style>

<script is:inline src="/src/scripts/menu.js"></script>
</body>
</html>
Loading
Loading