Complete main UI #37
@@ -4,9 +4,8 @@ import '@/assets/css/components/common/card.scss'
|
||||
interface CardProps
|
||||
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {}
|
||||
|
||||
const Card = forwardRef<HTMLDivElement, CardProps>((props, ref) => {
|
||||
const { className, ..._props } = props
|
||||
return <div className={`card-box${className ? ` ${className}` : ''}`} {..._props} ref={ref} />
|
||||
const Card = forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => {
|
||||
return <div className={`card-box${className ? ` ${className}` : ''}`} {...props} ref={ref} />
|
||||
})
|
||||
|
||||
export default Card
|
||||
|
||||
@@ -6,14 +6,13 @@ interface FitCenterProps
|
||||
vertical?: boolean
|
||||
}
|
||||
|
||||
const FitCenter: React.FC<FitCenterProps> = (props) => {
|
||||
const { className, vertical, ..._props } = props
|
||||
const FitCenter: React.FC<FitCenterProps> = ({ className, vertical, ...props }) => {
|
||||
return (
|
||||
<div
|
||||
className={`fit-center${className ? ` ${className}` : ''}${
|
||||
vertical ? ' flex-vertical' : ' flex-horizontal'
|
||||
}`}
|
||||
{..._props}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,20 +7,21 @@ interface FitFullscreenProps
|
||||
backgroundColor?: string
|
||||
}
|
||||
|
||||
const FitFullscreen = forwardRef<HTMLDivElement, FitFullscreenProps>((props, ref) => {
|
||||
const { zIndex, backgroundColor, className, style, ..._props } = props
|
||||
return (
|
||||
<div
|
||||
className={`fit-fullscreen${className ? ` ${className}` : ''}`}
|
||||
style={{
|
||||
zIndex,
|
||||
backgroundColor,
|
||||
...style
|
||||
}}
|
||||
ref={ref}
|
||||
{..._props}
|
||||
/>
|
||||
)
|
||||
})
|
||||
const FitFullscreen = forwardRef<HTMLDivElement, FitFullscreenProps>(
|
||||
({ zIndex, backgroundColor, className, style, ...props }, ref) => {
|
||||
return (
|
||||
<div
|
||||
className={`fit-fullscreen${className ? ` ${className}` : ''}`}
|
||||
style={{
|
||||
zIndex,
|
||||
backgroundColor,
|
||||
...style
|
||||
}}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
export default FitFullscreen
|
||||
|
||||
@@ -7,18 +7,19 @@ interface FlexBoxProps
|
||||
gap?: number
|
||||
}
|
||||
|
||||
const FlexBox = forwardRef<HTMLDivElement, FlexBoxProps>((props, ref) => {
|
||||
const { className, direction, gap, style, ..._props } = props
|
||||
return (
|
||||
<div
|
||||
className={`flex-box ${
|
||||
direction === 'horizontal' ? 'flex-horizontal' : 'flex-vertical'
|
||||
}${className ? ` ${className}` : ''}`}
|
||||
style={{ gap, ...style }}
|
||||
{..._props}
|
||||
ref={ref}
|
||||
/>
|
||||
)
|
||||
})
|
||||
const FlexBox = forwardRef<HTMLDivElement, FlexBoxProps>(
|
||||
({ className, direction, gap, style, ...props }, ref) => {
|
||||
return (
|
||||
<div
|
||||
className={`flex-box ${
|
||||
direction === 'horizontal' ? 'flex-horizontal' : 'flex-vertical'
|
||||
}${className ? ` ${className}` : ''}`}
|
||||
style={{ gap, ...style }}
|
||||
{...props}
|
||||
ref={ref}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
export default FlexBox
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,9 +8,7 @@ interface IndicatorProps {
|
||||
onSwitch?: (index: number) => void
|
||||
}
|
||||
|
||||
const Indicator: React.FC<IndicatorProps> = (props) => {
|
||||
const { total, current, onSwitch } = props
|
||||
|
||||
const Indicator: React.FC<IndicatorProps> = ({ total, current, onSwitch }) => {
|
||||
const handleClick = (index: number) => {
|
||||
return () => {
|
||||
onSwitch && onSwitch(index)
|
||||
|
||||
@@ -2,10 +2,8 @@ import React from 'react'
|
||||
|
||||
const SidebarSeparate: React.FC<
|
||||
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
|
||||
> = (props) => {
|
||||
const { className, ..._props } = props
|
||||
|
||||
return <div className={`separate ${className ? ` ${className}` : ''}`} {..._props} />
|
||||
> = ({ className, ...props }) => {
|
||||
return <div className={`separate ${className ? ` ${className}` : ''}`} {...props} />
|
||||
}
|
||||
|
||||
export default SidebarSeparate
|
||||
|
||||
@@ -6,7 +6,7 @@ import HideScrollbar from '@/components/common/HideScrollbar'
|
||||
import FitFullscreen from '@/components/common/FitFullscreen'
|
||||
import FlexBox from '@/components/common/FlexBox'
|
||||
import Card from '@/components/common/Card'
|
||||
import Permission from '@/components/common/Permission.tsx'
|
||||
import Permission from '@/components/common/Permission'
|
||||
|
||||
interface CommonCardProps
|
||||
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
||||
@@ -16,11 +16,10 @@ interface CommonCardProps
|
||||
url?: string
|
||||
}
|
||||
|
||||
const CommonCard = forwardRef<HTMLDivElement, CommonCardProps>((props) => {
|
||||
const navigate = useNavigate()
|
||||
const cardRef = useRef<HTMLDivElement>(null)
|
||||
const {
|
||||
const CommonCard = forwardRef<HTMLDivElement, CommonCardProps>(
|
||||
({
|
||||
style,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
ref,
|
||||
icon,
|
||||
description,
|
||||
@@ -32,32 +31,35 @@ const CommonCard = forwardRef<HTMLDivElement, CommonCardProps>((props) => {
|
||||
},
|
||||
url,
|
||||
children,
|
||||
..._props
|
||||
} = props
|
||||
...props
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const cardRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
cardRef.current && VanillaTilt.init(cardRef.current, options)
|
||||
}, [options])
|
||||
useEffect(() => {
|
||||
cardRef.current && VanillaTilt.init(cardRef.current, options)
|
||||
}, [options])
|
||||
|
||||
const handleCardOnClick = () => {
|
||||
url && navigate(url)
|
||||
const handleCardOnClick = () => {
|
||||
url && navigate(url)
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
style={{ overflow: 'visible', ...style }}
|
||||
ref={cardRef}
|
||||
{...props}
|
||||
onClick={handleCardOnClick}
|
||||
>
|
||||
<FlexBox className={'common-card'}>
|
||||
<Icon component={icon} className={'icon'} />
|
||||
<div className={'text'}>{children}</div>
|
||||
<div className={'description'}>{description}</div>
|
||||
</FlexBox>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
style={{ overflow: 'visible', ...style }}
|
||||
ref={cardRef}
|
||||
{..._props}
|
||||
onClick={handleCardOnClick}
|
||||
>
|
||||
<FlexBox className={'common-card'}>
|
||||
<Icon component={icon} className={'icon'} />
|
||||
<div className={'text'}>{children}</div>
|
||||
<div className={'description'}>{description}</div>
|
||||
</FlexBox>
|
||||
</Card>
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
const System: React.FC = () => {
|
||||
return (
|
||||
|
||||
@@ -15,7 +15,7 @@ import { BarChart, BarSeriesOption, LineChart, LineSeriesOption } from 'echarts/
|
||||
import { SVGRenderer } from 'echarts/renderers'
|
||||
import { UniversalTransition } from 'echarts/features'
|
||||
import { CallbackDataParams } from 'echarts/types/dist/shared'
|
||||
import { utcToLocalTime } from '@/util/datetime.tsx'
|
||||
import { utcToLocalTime } from '@/util/datetime'
|
||||
|
||||
echarts.use([
|
||||
TooltipComponent,
|
||||
|
||||
@@ -25,7 +25,7 @@ const system: RouteJsonObject[] = [
|
||||
path: 'settings',
|
||||
absolutePath: '/system/settings',
|
||||
id: 'system-settings',
|
||||
component: React.lazy(() => import('@/pages/system/Settings')),
|
||||
component: React.lazy(() => import('@/pages/system/settings')),
|
||||
name: '系统设置',
|
||||
icon: React.lazy(() => import('~icons/oxygen/option.jsx')),
|
||||
menu: true,
|
||||
|
||||
Reference in New Issue
Block a user