Commit defc2a80 authored by timel's avatar timel

feat: layout and start

parent 00b68aa0
Pipeline #22827 passed with stages
in 16 minutes and 38 seconds
...@@ -107,7 +107,8 @@ p, ...@@ -107,7 +107,8 @@ p,
section, section,
span, span,
image, image,
img { img,
nav {
box-sizing: border-box; box-sizing: border-box;
} }
......
.navbar {
--height: 48px;
width: 100%;
height: var(--height);
display: flex;
flex-wrap: wrap;
align-content: center;
padding: 0 1rem;
gap: 1rem;
box-sizing: border-box;
.logo {
height: 100%;
filter: brightness(1.5);
margin-right: -10px; // 以后删除这个,现在这么写是因为图片边框有点大
}
a {
color: white;
font-family: sans-serif;
text-decoration: none;
font-size: 0.825rem;
line-height: var(--height);
// height: fit-content;
}
}
import { NavLink, Outlet } from "react-router-dom";
import { useConfig } from "@/config";
const NeosConfig = useConfig();
import styles from "./index.module.scss";
export const NeosLayout = () => {
return (
<>
<nav className={styles.navbar}>
<img
className={styles.logo}
src={`${NeosConfig.assetsPath}/neos_logo.png`}
alt="NEOS"
/>
<NavLink to="/">主页</NavLink>
<NavLink to="/match">匹配</NavLink>
<NavLink to="/build">组卡</NavLink>
<span style={{ flexGrow: 1 }} />
<NavLink to="/home">我的</NavLink>
</nav>
<Outlet />
</>
);
};
...@@ -6,6 +6,7 @@ import { ...@@ -6,6 +6,7 @@ import {
RouterProvider, RouterProvider,
} from "react-router-dom"; } from "react-router-dom";
import { NeosLayout } from "./Layout";
import LazyLoad, { Loading } from "./LazyLoad"; import LazyLoad, { Loading } from "./LazyLoad";
const Start = React.lazy(() => import("./Start")); const Start = React.lazy(() => import("./Start"));
...@@ -17,10 +18,28 @@ const Replay = React.lazy(() => import("./Replay")); ...@@ -17,10 +18,28 @@ const Replay = React.lazy(() => import("./Replay"));
const SSO = React.lazy(() => import("./SSO")); const SSO = React.lazy(() => import("./SSO"));
const Home = React.lazy(() => import("./Home")); const Home = React.lazy(() => import("./Home"));
// TODO: finish this
const _router = createBrowserRouter([
{
path: "/",
element: <NeosLayout />,
children: [
{
path: "/",
element: <LazyLoad lazy={<Start />} />,
},
{
path: "/match",
element: <LazyLoad lazy={<Match />} />,
},
],
},
]);
// 暂且先这么写,为后重构为createBrowserRouter打基础 // 暂且先这么写,为后重构为createBrowserRouter打基础
const router = createBrowserRouter( const router = createBrowserRouter(
createRoutesFromElements( createRoutesFromElements(
<Route> <Route path="/" element={<NeosLayout />}>
<Route path="/" element={<LazyLoad lazy={<Start />} />} /> <Route path="/" element={<LazyLoad lazy={<Start />} />} />
<Route path="/home" element={<LazyLoad lazy={<Home />} />} /> <Route path="/home" element={<LazyLoad lazy={<Home />} />} />
<Route path="/match" element={<LazyLoad lazy={<Match />} />} /> <Route path="/match" element={<LazyLoad lazy={<Match />} />} />
......
...@@ -11,24 +11,6 @@ body * { ...@@ -11,24 +11,6 @@ body * {
font-size: 1em; font-size: 1em;
} }
.mycard-header {
position: relative;
z-index: 5000;
top: 0;
left: 0;
background: rgba(0, 0, 0, .6);
border-bottom: 1px solid rgba(150, 150, 150, .2);
width: 100%;
height: 40px;
}
.mycard-header > a:first-child {
display: inline-block;
position: absolute;
left: 2%;
top: 0;
}
.wrapper { .wrapper {
position: relative; position: relative;
} }
...@@ -37,49 +19,71 @@ body * { ...@@ -37,49 +19,71 @@ body * {
z-index: 20; z-index: 20;
} }
.neos-header { .main {
display: flex; height: 650px;
align-items: center; width: 650px;
justify-content: center; margin: auto;
z-index: 20; margin-top: 50px; // FIXME
padding: 22em 0 4em;
}
.neos-header::after {
background-image: url(/neos-assets/monster.png);
background-position: center -50px;
content: "";
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-repeat: no-repeat;
z-index: 1;
}
.neos-header h1 {
margin-bottom: 1em;
padding: 0 1.5em;
position: relative; position: relative;
z-index: 2; .neos-pic {
max-width: 100%;
max-height: 100%;
z-index: 1;
}
.neos-logo {
filter: brightness(2) drop-shadow(0 0 0.75rem #ffffffb8)
drop-shadow(0 0 0.1rem #373737c6);
position: absolute;
bottom: 0%;
width: 100%;
left: 50%;
transform: translateX(-50%);
}
} }
.neos-header button { .start-btn {
color: white;
font-family: sans-serif;
text-decoration: none;
appearance: none;
cursor: pointer;
position: relative; position: relative;
background-color: transparent; display: inline-flex;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
white-space-collapse: collapse;
text-wrap: nowrap;
user-select: none;
max-width: 100%;
flex-shrink: 0;
height: 48px;
border-radius: 9999px;
text-shadow: rgba(0, 0, 0, 0.25) 0px 3px 8px;
gap: 8px;
margin: 0px;
font: inherit inherit inherit inherit inherit inherit inherit inherit inherit
inherit inherit inherit inherit;
transition: border 120ms ease 0s, background-color, color, box-shadow, opacity;
padding: 0px 24px;
border-width: initial;
border-style: none; border-style: none;
color: rgba(255, 255, 255, .8); border-color: initial;
font-family: var(--theme-font); border-image: initial;
font-size: 2.5em; background: linear-gradient(
font-weight: bold; 92.88deg,
text-shadow: 0 0 0.5em #a2162d, 0 0 0.5em #f80000d6; rgb(69, 94, 181) 9.16%,
z-index: 2; rgb(86, 67, 204) 43.89%,
rgb(103, 63, 215) 64.72%
);
transition: 0.2s;
&:hover {
filter: brightness(1.2);
}
} }
.neos-header button:hover { // 以下是粒子动画的样式
text-shadow: 0 0 0.5em #2137bd, 0 0 0.5em #2137bd;
}
.particles-container { .particles-container {
width: 100%; width: 100%;
......
import React from "react"; import React from "react";
import { useNavigate } from "react-router-dom"; import { Link } from "react-router-dom";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
...@@ -7,46 +7,31 @@ import styles from "./index.module.scss"; ...@@ -7,46 +7,31 @@ import styles from "./index.module.scss";
const NeosConfig = useConfig(); const NeosConfig = useConfig();
const Start: React.FC = () => { const Start: React.FC = () => {
const navigate = useNavigate();
return ( return (
<> <>
<div className={styles["mycard-header"]}>
<a href="https://mycard.moe/">
<img
src={`${NeosConfig.assetsPath}/mycard_logo.png`}
alt="MyCard"
width={130}
height={40}
/>
</a>
</div>
<div className={styles.wrapper}> <div className={styles.wrapper}>
<div className={styles["particles-container"]}> <div className={styles["particles-container"]}>
{Array.from({ length: 100 }).map((_) => ( {Array.from({ length: 100 }).map((_, key) => (
<div className={styles["particle-container"]}> <div key={key} className={styles["particle-container"]}>
<div className={styles["particle"]} /> <div className={styles["particle"]} />
</div> </div>
))} ))}
</div> </div>
<div role="banner" className={styles["neos-header"]}> <main className={styles["main"]}>
<div> <img
<h1> className={styles["neos-logo"]}
<img src={`${NeosConfig.assetsPath}/neos_logo.png`}
src={`${NeosConfig.assetsPath}/neos_logo.png`} alt="YGO NEOS"
width={540} />
height={250} <img
alt="YGO NEOS" className={styles["neos-pic"]}
/> src={`${NeosConfig.assetsPath}/neos.png`}
</h1> alt="neos"
<button />
onClick={() => { </main>
navigate("/sso"); <Link to="/sso" className={styles["start-btn"]}>
}} 登录游戏
> </Link>
登录萌卡进行游玩
</button>
</div>
</div>
</div> </div>
</> </>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment