Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web2022
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
web2022
Commits
752eb31e
Commit
752eb31e
authored
Aug 05, 2022
by
mxm-web-develop
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of gitlab.33.cn:Website/web2022
parents
7fe9ae14
ef196d79
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
11 deletions
+43
-11
AppProvider.tsx
src/store/AppProvider.tsx
+2
-2
EventItem.tsx
src/views/About/Memorabilia/EventItem.tsx
+18
-4
index.tsx
src/views/About/Memorabilia/index.tsx
+23
-5
No files found.
src/store/AppProvider.tsx
View file @
752eb31e
...
...
@@ -34,11 +34,11 @@ const AppReducer = (state:typeof data,action:Actions)=>{
}
return
{...
state
}
}
export
const
resizeOb
=
fromEvent
(
window
,
'resize'
)
export
const
AppProvider
=
(
props
:
any
)
=>
{
const
[
state
,
dispatch
]
=
useReducer
(
AppReducer
,
data
)
const
location
=
useLocation
()
const
ob
=
fromEvent
(
window
,
'resize'
)
useEffect
(()
=>
{
dispatch
({
type
:
'routerOnChange'
,
payload
:{
currentPage
:
location
.
pathname
}})
dispatch
({
type
:
'slideOnChange'
,
payload
:{
pageIndex
:
0
}})
...
...
src/views/About/Memorabilia/EventItem.tsx
View file @
752eb31e
...
...
@@ -7,6 +7,7 @@ import {
useInteractions
,
useHover
,
}
from
"@floating-ui/react-dom-interactions"
;
import
{
resizeOb
}
from
"@/store/AppProvider"
;
interface
EventItemType
extends
IProps
{
itmeIndex
:
number
;
data
:
any
;
...
...
@@ -86,7 +87,7 @@ export const EventItem = (props: EventItemType) => {
export
const
EventCols
=
(
props
:
EventColsType
)
=>
{
const
{
data
}
=
props
;
return
(
<
div
className=
"grid grid-cols-4 pb-[3rem]"
>
<
div
className=
"grid grid-cols-4
labtop:grid-cols-5
pb-[3rem]"
>
{
data
&&
data
.
length
>
0
&&
data
.
map
((
i
:
any
,
index
:
number
)
=>
(
...
...
@@ -96,14 +97,27 @@ export const EventCols = (props: EventColsType) => {
);
};
const
checkWidth
=
(
width
:
number
)
=>
{
return
width
>=
1920
}
export
const
EventsTable
=
(
props
:
EventsTableType
)
=>
{
const
{
tableIndex
,
data
}
=
props
;
const
[
colData
,
setColData
]
=
useState
<
undefined
|
any
[]
>
(
undefined
);
useEffect
(()
=>
{
const
half
=
4
;
const
setData
=
(
width
:
number
)
=>
{
let
half
=
4
if
(
checkWidth
(
width
)){
half
=
5
}
const
c
=
_chunk
(
data
,
half
);
setColData
(
c
);
}
useEffect
(()
=>
{
resizeOb
.
subscribe
((
event
)
=>
{
//@ts-ignore
setData
(
event
.
currentTarget
?.
innerWidth
)
})
setData
(
window
.
innerWidth
)
// setData(4);
},
[
data
]);
return
(
<
div
>
...
...
src/views/About/Memorabilia/index.tsx
View file @
752eb31e
...
...
@@ -7,18 +7,36 @@ import { EventItem, EventsTable } from "./EventItem"
import
{
EventsScrollView
}
from
"@/components/EventsScrollView"
import
Step
from
"@/assets/img/step.png"
import
{
resizeOb
}
from
"@/store/AppProvider"
;
interface
MemorabiliaType
extends
IProps
{
}
const
checkWidth
=
(
width
:
number
)
=>
{
return
width
>=
1920
}
export
const
Memorabilia
=
()
=>
{
const
[
data
,
setData
]
=
useState
<
any
>
()
const
[
currentSlide
,
setCurrentSlide
]
=
useState
(
0
)
useEffect
(()
=>
{
const
fetchData
=
getEvents
(
8
).
subscribe
(
v
=>
{
let
fetchNum
=
8
,
fetchData
:
any
=
null
;
resizeOb
.
subscribe
((
event
)
=>
{
//@ts-ignore
const
_fetchNum
=
checkWidth
(
event
.
currentTarget
.
innerWidth
)?
10
:
8
if
(
_fetchNum
!==
fetchNum
){
fetchNum
=
_fetchNum
setData
(
data
.
slice
(
0
,
8
))
fetchData
=
getEvents
(
_fetchNum
).
subscribe
(
v
=>
{
setData
(
v
)
},
err
=>
{
throw
new
Error
(
err
)})
}
})
fetchData
=
getEvents
(
checkWidth
(
window
.
innerWidth
)?
10
:
8
).
subscribe
(
v
=>
{
setData
(
v
)
},
err
=>
{
throw
new
Error
(
err
)})
return
()
=>
fetchData
.
unsubscribe
()
...
...
@@ -45,10 +63,10 @@ export const Memorabilia = () => {
}
return
(
<
AppContianer
className=
"flex items-center justify-start h-full w-full
relative
labtop:px-[120px] "
>
<
AppContianer
className=
"flex items-center justify-start h-full w-full labtop:px-[120px] "
>
<
div
className=
'w-[896px]'
>
<
div
className=
'absolute top-12
labtop:right-[14rem] right-[7rem
]'
>
<
div
className=
'w-[896px]
labtop:w-[1120px] min-h-[750px] relative
'
>
<
div
className=
'absolute top-12
right-0 translate-x-[100%
]'
>
<
div
className=
"hero-title"
>
Memorabilia
</
div
>
<
div
className=
"subTitle-1-cn py-3 flex items-center gap-x-5"
>
<
div
className=
" w-28 h-1 bg-theme-dark rounded"
></
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment