Skip to content

Commit

Permalink
优化首页样式
Browse files Browse the repository at this point in the history
  • Loading branch information
sumingcheng committed Dec 10, 2024
1 parent 8f06062 commit eaebe1f
Show file tree
Hide file tree
Showing 10 changed files with 546 additions and 55 deletions.
2 changes: 2 additions & 0 deletions docs/Frontend/TypeScript/90.高级类型.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function doStuff(q: A | B) {

## 可辨识联合类型

```typescript
interface Square {
kind: "square";
size: number;
Expand All @@ -164,3 +165,4 @@ case "square": return s.size _ s.size;
case "rectangle": return s.width _ s.height;
}
}
```
7 changes: 6 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const config = {
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// 即使不使���国际化,也必须在此设置有用的元数据
// 即使不使用国际化,也必须在此设置有用的元数据
// 例如,中文网站可将"en"替换为"zh-CN"
i18n: {
defaultLocale: "zh-CN",
Expand Down Expand Up @@ -119,6 +119,11 @@ const config = {
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap",
},
{
tagName: "link",
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap",
},
],
navbar: navbar,
footer: {
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-icons": "^5.4.0",
"sass": "^1.82.0"
},
"devDependencies": {
Expand Down
16 changes: 8 additions & 8 deletions sidebars.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// Resource
resourceSidebar: [
{
type: "autogenerated",
dirName: "Resource",
},
],

// Backend
goSidebar: [
{
Expand Down Expand Up @@ -221,6 +213,14 @@ const sidebars = {
dirName: "Other/Notes",
},
],

// Resource
resourceSidebar: [
{
type: "autogenerated",
dirName: "Resource",
},
],
}

module.exports = sidebars
14 changes: 14 additions & 0 deletions src/components/NeonButton/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import styles from './styles.module.scss';

export default function NeonButton({ children, to, className, ...props }) {
return (
<a
className={`${styles.neonButton} ${className || ''}`}
href={to}
{...props}
>
{children}
</a>
);
}
96 changes: 96 additions & 0 deletions src/components/NeonButton/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.neonButton {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.8rem 2rem;
font-size: 1.2rem;
font-weight: 600;
color: #fff;
background: var(--ifm-color-primary);
border: none;
border-radius: 8px;
text-decoration: none;
cursor: pointer;
z-index: 1;

&::before,
&::after {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
border-radius: 10px;
transition: 0.3s ease-in-out;
}

&::before {
z-index: -2;
background: linear-gradient(
90deg,
#00fff3,
// 霓虹青色
#ff00c1,
// 霓虹粉
#00ff8f,
// 荧光绿
#9600ff,
// 紫罗兰
#00fff3 // 回到霓虹青色
);
background-size: 300%;
filter: blur(5px);
opacity: 0;
transition: opacity 0.3s ease;
}

&::after {
z-index: -1;
background: var(--ifm-color-primary);
border-radius: 8px;
}

&:hover {
color: #fff;
text-decoration: none;

&::before {
opacity: 1;
animation: glowing 2s linear infinite;
}
}

&:active {
transform: translateY(0);
}
}

@keyframes glowing {
0% {
background-position: 0% center;
opacity: 0.8;
}
25% {
opacity: 1;
}
50% {
background-position: -100% center;
opacity: 1;
}
75% {
opacity: 0.8;
}
100% {
background-position: -200% center;
opacity: 0.8;
}
}

// 暗色主题只改变背景色
[data-theme='dark'] .neonButton {
&::after {
background: var(--ifm-color-primary-darker);
}
}
Loading

0 comments on commit eaebe1f

Please sign in to comment.