Complete main UI #37
@@ -9,10 +9,15 @@
|
|||||||
top: 20px;
|
top: 20px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.hide {
|
||||||
|
transform: translateY(-60px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.root-content {
|
.root-content {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DetailedHTMLProps, HTMLAttributes, MouseEvent, ReactNode } from 'react'
|
import { DetailedHTMLProps, HTMLAttributes, MouseEvent, ReactNode, UIEvent, useState } from 'react'
|
||||||
import VanillaTilt, { TiltOptions } from 'vanilla-tilt'
|
import VanillaTilt, { TiltOptions } from 'vanilla-tilt'
|
||||||
import Icon from '@ant-design/icons'
|
import Icon from '@ant-design/icons'
|
||||||
import '@/assets/css/pages/tools/store.scss'
|
import '@/assets/css/pages/tools/store.scss'
|
||||||
@@ -136,15 +136,26 @@ const LoadMoreCard = ({ onClick }: LoadMoreCardProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Store = () => {
|
const Store = () => {
|
||||||
|
const scrollTopRef = useRef(0)
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [currentPage, setCurrentPage] = useState(0)
|
const [currentPage, setCurrentPage] = useState(0)
|
||||||
const [hasNextPage, setHasNextPage] = useState(true)
|
const [hasNextPage, setHasNextPage] = useState(true)
|
||||||
const [toolData, setToolData] = useState<ToolVo[]>([])
|
const [toolData, setToolData] = useState<ToolVo[]>([])
|
||||||
|
const [hideSearch, setHideSearch] = useState(false)
|
||||||
|
|
||||||
const handleOnSearch = (value: string) => {
|
const handleOnSearch = (value: string) => {
|
||||||
getTool(1, value)
|
getTool(1, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleOnScroll = (event: UIEvent<HTMLDivElement>) => {
|
||||||
|
if (event.currentTarget.scrollTop < scrollTopRef.current) {
|
||||||
|
setHideSearch(false)
|
||||||
|
} else {
|
||||||
|
setHideSearch(true)
|
||||||
|
}
|
||||||
|
scrollTopRef.current = event.currentTarget.scrollTop
|
||||||
|
}
|
||||||
|
|
||||||
const handleOnLoadMore = () => {
|
const handleOnLoadMore = () => {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return
|
return
|
||||||
@@ -192,11 +203,16 @@ const Store = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FitFullscreen data-component={'tools-store'}>
|
<FitFullscreen data-component={'tools-store'}>
|
||||||
<HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={1000}>
|
<HideScrollbar
|
||||||
<div className={'search'}>
|
isShowVerticalScrollbar
|
||||||
|
autoHideWaitingTime={1000}
|
||||||
|
onScroll={handleOnScroll}
|
||||||
|
>
|
||||||
|
<div className={`search${hideSearch ? ' hide' : ''}`}>
|
||||||
<AntdInput.Search
|
<AntdInput.Search
|
||||||
placeholder={'请输入工具名或关键字'}
|
placeholder={'请输入工具名或关键字'}
|
||||||
enterButton
|
enterButton
|
||||||
|
allowClear
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
onSearch={handleOnSearch}
|
onSearch={handleOnSearch}
|
||||||
/>
|
/>
|
||||||
@@ -204,6 +220,7 @@ const Store = () => {
|
|||||||
<FlexBox direction={'horizontal'} className={'root-content'}>
|
<FlexBox direction={'horizontal'} className={'root-content'}>
|
||||||
{toolData?.map((value) => (
|
{toolData?.map((value) => (
|
||||||
<CommonCard
|
<CommonCard
|
||||||
|
key={value.id}
|
||||||
icon={
|
icon={
|
||||||
<img
|
<img
|
||||||
src={`data:image/svg+xml;base64,${value.icon}`}
|
src={`data:image/svg+xml;base64,${value.icon}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user