Merge pull request 'Add vertical prop to FitCenter. Add OxygenToolbox to home page. Add Indicator to home.' (#20) from FatttSnake into dev
Reviewed-on: FatttSnake/fatweb-ui#20
This commit was merged in pull request #20.
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
$main-color: #00D4FF;
|
@use '@/assets/css/constants.scss' as constants;
|
||||||
$background-color: #F5F5F5;
|
|
||||||
$font-main-color: #4D4D4D;
|
|
||||||
$font-secondary-color: #9E9E9E;
|
|
||||||
|
|
||||||
#root {
|
#root {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
@@ -9,7 +6,7 @@ $font-secondary-color: #9E9E9E;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
color: $font-main-color;
|
color: constants.$font-main-color;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
min-width: 900px;
|
min-width: 900px;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
@@ -108,3 +105,11 @@ $font-secondary-color: #9E9E9E;
|
|||||||
height: 23px;
|
height: 23px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex-horizontal {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-vertical {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
28
src/assets/css/components/common/indicator.scss
Normal file
28
src/assets/css/components/common/indicator.scss
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
@use '@/assets/css/constants.scss' as constants;
|
||||||
|
|
||||||
|
.dot-list {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
flex: auto;
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: {
|
||||||
|
width: 2px;
|
||||||
|
color: constants.$font-secondary-color;
|
||||||
|
style: solid;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.active>* {
|
||||||
|
background-color: constants.$font-secondary-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/assets/css/components/home/home.scss
Normal file
11
src/assets/css/components/home/home.scss
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.indicator {
|
||||||
|
position: fixed;
|
||||||
|
margin: {
|
||||||
|
right: 20px;
|
||||||
|
};
|
||||||
|
width: 20px;
|
||||||
|
height: 100px;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@use "../../mixins" as mixins;
|
@use "@/assets/css/mixins" as mixins;
|
||||||
|
|
||||||
.center-box {
|
.center-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
4
src/assets/css/constants.scss
Normal file
4
src/assets/css/constants.scss
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
$main-color: #00D4FF;
|
||||||
|
$background-color: #F5F5F5;
|
||||||
|
$font-main-color: #4D4D4D;
|
||||||
|
$font-secondary-color: #9E9E9E;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@use "../mixins" as mixins;
|
@use "@/assets/css/mixins" as mixins;
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
|
|
||||||
const Project: React.FC = () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<h1>App</h1>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Project
|
|
||||||
@@ -1,13 +1,21 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import '@/assets/css/components/common/fit-center.scss'
|
import '@/assets/css/components/common/fit-center.scss'
|
||||||
|
|
||||||
const FitCenter: React.FC<
|
interface FitCenterProps
|
||||||
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
|
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
||||||
> = (props) => {
|
vertical?: boolean
|
||||||
const { className, ..._props } = props
|
}
|
||||||
|
|
||||||
|
const FitCenter: React.FC<FitCenterProps> = (props) => {
|
||||||
|
const { className, vertical, ..._props } = props
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={`fit-center${className ? ' ' + className : ''}`} {..._props}></div>
|
<div
|
||||||
|
className={`fit-center${className ? ' ' + className : ''}${
|
||||||
|
vertical ? ' flex-vertical' : ' flex-horizontal'
|
||||||
|
}`}
|
||||||
|
{..._props}
|
||||||
|
></div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
39
src/components/common/Indicator.tsx
Normal file
39
src/components/common/Indicator.tsx
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import _ from 'lodash'
|
||||||
|
import '@/assets/css/components/common/indicator.scss'
|
||||||
|
|
||||||
|
interface IndicatorProps {
|
||||||
|
total: number
|
||||||
|
current: number
|
||||||
|
onSwitch?: (index: number) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const Indicator: React.FC<IndicatorProps> = (props) => {
|
||||||
|
const { total, current, onSwitch } = props
|
||||||
|
|
||||||
|
const handleClick = (index: number) => {
|
||||||
|
return () => {
|
||||||
|
onSwitch && onSwitch(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ul className={'dot-list flex-vertical'}>
|
||||||
|
{_.range(0, total).map((_value, index) => {
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
key={index}
|
||||||
|
className={'item center-box' + (index === current ? ' active' : '')}
|
||||||
|
onClick={handleClick(index)}
|
||||||
|
>
|
||||||
|
<div className={'dot'} />
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Indicator
|
||||||
17
src/components/home/OxygenToolbox.tsx
Normal file
17
src/components/home/OxygenToolbox.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import FitCenter from '@/components/common/FitCenter.tsx'
|
||||||
|
|
||||||
|
const OxygenToolbox: React.FC = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<FitCenter vertical>
|
||||||
|
<div>
|
||||||
|
<div style={{ fontSize: '4.5em', fontWeight: 'bold' }}>Oxygen Toolbox</div>
|
||||||
|
<div style={{ fontSize: '1.4em', textAlign: 'end' }}>is coming soon...</div>
|
||||||
|
</div>
|
||||||
|
</FitCenter>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OxygenToolbox
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
import React, { useEffect } from 'react'
|
import React, { useEffect } from 'react'
|
||||||
|
import '@/assets/css/components/home/home.scss'
|
||||||
import FitFullScreen from '@/components/common/FitFullScreen'
|
import FitFullScreen from '@/components/common/FitFullScreen'
|
||||||
import FitCenter from '@/components/common/FitCenter'
|
import FitCenter from '@/components/common/FitCenter'
|
||||||
import { MainFrameworkContext } from '@/pages/MainFramework'
|
import { MainFrameworkContext } from '@/pages/MainFramework'
|
||||||
import Slogan from '@/components/home/Slogan'
|
import Slogan from '@/components/home/Slogan'
|
||||||
|
import OxygenToolbox from '@/components/home/OxygenToolbox'
|
||||||
|
import Indicator from '@/components/common/Indicator.tsx'
|
||||||
|
|
||||||
const Home: React.FC = () => {
|
const Home: React.FC = () => {
|
||||||
const {
|
const {
|
||||||
hideScrollbarRef,
|
hideScrollbarRef,
|
||||||
navbarHiddenState: { setNavbarHidden },
|
navbarHiddenState: { navbarHidden, setNavbarHidden },
|
||||||
preventScrollState: { setPreventScroll }
|
preventScrollState: { setPreventScroll }
|
||||||
} = useContext(MainFrameworkContext)
|
} = useContext(MainFrameworkContext)
|
||||||
|
|
||||||
@@ -121,6 +124,7 @@ const Home: React.FC = () => {
|
|||||||
if (event.key === 'ArrowDown') {
|
if (event.key === 'ArrowDown') {
|
||||||
handleScrollDown()
|
handleScrollDown()
|
||||||
}
|
}
|
||||||
|
console.log(content.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = [
|
const content = [
|
||||||
@@ -129,7 +133,7 @@ const Home: React.FC = () => {
|
|||||||
ref: fitFullScreenRef,
|
ref: fitFullScreenRef,
|
||||||
children: <Slogan onClickScrollDown={handleScrollDown} />
|
children: <Slogan onClickScrollDown={handleScrollDown} />
|
||||||
},
|
},
|
||||||
{ children: <FitCenter>2</FitCenter> },
|
{ children: <OxygenToolbox /> },
|
||||||
{ children: <FitCenter>3</FitCenter> }
|
{ children: <FitCenter>3</FitCenter> }
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -148,6 +152,10 @@ const Home: React.FC = () => {
|
|||||||
return <FitFullScreen key={index} {...element} />
|
return <FitFullScreen key={index} {...element} />
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div hidden={navbarHidden} className={'indicator'}>
|
||||||
|
<Indicator total={content.length} current={currentContent} />
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,16 +38,6 @@ const routes: RouteObject[] = [
|
|||||||
menu: true,
|
menu: true,
|
||||||
auth: false
|
auth: false
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'project',
|
|
||||||
id: 'project',
|
|
||||||
Component: React.lazy(() => import('@/components/Project')),
|
|
||||||
handle: {
|
|
||||||
name: '项目',
|
|
||||||
menu: true,
|
|
||||||
auth: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user