Add tools menu and submenu. Add Add multiple environments. #28
@@ -50,6 +50,7 @@
|
||||
|
||||
.item {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
font-size: 1.5em;
|
||||
transition: {
|
||||
property: all;
|
||||
@@ -72,9 +73,37 @@
|
||||
};
|
||||
}
|
||||
|
||||
:hover {
|
||||
.item:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.item:hover .submenu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.submenu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
transform: translateY(4px);
|
||||
border: {
|
||||
width: 1px;
|
||||
color: constants.$border-color;
|
||||
style: solid;
|
||||
};
|
||||
|
||||
.item {
|
||||
display: block;
|
||||
padding: 10px;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.item:hover {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu-button {
|
||||
|
||||
@@ -4,7 +4,7 @@ import FitFullScreen from '@/components/common/FitFullScreen'
|
||||
import { MainFrameworkContext } from '@/pages/MainFramework'
|
||||
import Slogan from '@/components/home/Slogan'
|
||||
import OxygenToolbox from '@/components/home/OxygenToolbox'
|
||||
import Indicator from '@/components/common/Indicator.tsx'
|
||||
import Indicator from '@/components/common/Indicator'
|
||||
import Footer from '@/components/home/Footer'
|
||||
|
||||
const Home: React.FC = () => {
|
||||
@@ -90,7 +90,7 @@ const MainFramework: React.FC = () => {
|
||||
<nav>
|
||||
<ul className={'menu'}>
|
||||
{routeChildren?.map((route) => {
|
||||
return (
|
||||
return (route.handle as RouteHandle).menu ? (
|
||||
<li className={'item'} key={route.id}>
|
||||
<NavLink
|
||||
to={route.path ?? ''}
|
||||
@@ -104,7 +104,32 @@ const MainFramework: React.FC = () => {
|
||||
>
|
||||
{(route.handle as RouteHandle).name}
|
||||
</NavLink>
|
||||
{route.children ? (
|
||||
<ul className={'submenu'}>
|
||||
{route.children.map((subRoute) => {
|
||||
return (subRoute.handle as RouteHandle)
|
||||
.menu ? (
|
||||
<li
|
||||
className={'item'}
|
||||
key={subRoute.id}
|
||||
>
|
||||
{
|
||||
(
|
||||
subRoute.handle as RouteHandle
|
||||
).name
|
||||
}
|
||||
</li>
|
||||
) : (
|
||||
<></>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</li>
|
||||
) : (
|
||||
<></>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
|
||||
7
src/pages/Tools.tsx
Normal file
7
src/pages/Tools.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
const Tools: React.FC = () => {
|
||||
return <></>
|
||||
}
|
||||
|
||||
export default Tools
|
||||
7
src/pages/tools/Translation.tsx
Normal file
7
src/pages/tools/Translation.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
const Translation: React.FC = () => {
|
||||
return <></>
|
||||
}
|
||||
|
||||
export default Translation
|
||||
@@ -23,7 +23,7 @@ const routes: RouteObject[] = [
|
||||
{
|
||||
path: '',
|
||||
id: 'home',
|
||||
Component: React.lazy(() => import('@/components/home')),
|
||||
Component: React.lazy(() => import('@/pages/Home')),
|
||||
handle: {
|
||||
name: '主页',
|
||||
menu: true,
|
||||
@@ -38,6 +38,38 @@ const routes: RouteObject[] = [
|
||||
menu: true,
|
||||
auth: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'tools',
|
||||
id: 'tools',
|
||||
Component: React.lazy(() => import('@/pages/Tools')),
|
||||
children: [
|
||||
{
|
||||
path: 'translation',
|
||||
id: 'tools-translation',
|
||||
Component: React.lazy(() => import('@/pages/tools/Translation')),
|
||||
handle: {
|
||||
name: '翻译',
|
||||
menu: true,
|
||||
auth: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'translation',
|
||||
id: 'tools-translationa',
|
||||
Component: React.lazy(() => import('@/pages/tools/Translation')),
|
||||
handle: {
|
||||
name: '翻译',
|
||||
menu: true,
|
||||
auth: false
|
||||
}
|
||||
}
|
||||
],
|
||||
handle: {
|
||||
name: '工具',
|
||||
menu: true,
|
||||
auth: false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user