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
59375d7b
Commit
59375d7b
authored
Aug 04, 2022
by
mxm-web-develop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
321
parent
78d498f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
14 deletions
+39
-14
index.tsx
src/components/Navbar/index.tsx
+23
-4
AppProvider.tsx
src/store/AppProvider.tsx
+8
-7
NewsDetails.tsx
src/views/News/NewsDetails.tsx
+8
-3
No files found.
src/components/Navbar/index.tsx
View file @
59375d7b
...
@@ -98,8 +98,15 @@ const HoverLink = (props: HoverLinkType) => {
...
@@ -98,8 +98,15 @@ const HoverLink = (props: HoverLinkType) => {
export
default
function
Navbar
(
props
:
IAppProps
)
{
export
default
function
Navbar
(
props
:
IAppProps
)
{
const
{
pathname
}
=
useLocation
();
const
{
pathname
}
=
useLocation
();
const
{
data
}
=
React
.
useContext
(
AppContext
);
const
{
data
}
=
React
.
useContext
(
AppContext
);
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
();
// console.log('nav',data)
const
navbarWithBg
=
useCallback
(()
=>
{
if
(
pathname
.
includes
(
'/news/'
)){
return
true
}
return
false
;
},[
pathname
])
const
themeStyle
=
useCallback
(
const
themeStyle
=
useCallback
(
(
theme
:
string
,
active
:
boolean
)
=>
{
(
theme
:
string
,
active
:
boolean
)
=>
{
if
(
theme
===
"light"
)
{
if
(
theme
===
"light"
)
{
...
@@ -118,9 +125,21 @@ export default function Navbar(props: IAppProps) {
...
@@ -118,9 +125,21 @@ export default function Navbar(props: IAppProps) {
);
);
return
(
return
(
<>
<>
<
nav
className=
"invisible moblie:visible flex min-w-[1440px] justify-between absolute px-[120px] w-full top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal "
>
<
nav
className=
{
`invisible moblie:visible flex min-w-[1440px]
justify-between absolute px-[120px] w-full items-center
top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal
${navbarWithBg()?' bg-white':' bg-none'}
`
}
>
<
div
className=
"left "
>
<
div
className=
"left "
>
<
img
src=
{
data
.
theme
===
"dark"
||
pathname
===
'/news'
?
LogoWhite
:
Logo
}
onClick=
{
()
=>
navigate
(
'/'
)
}
className=
" cursor-pointer"
/>
<
img
src=
{
data
.
theme
===
"dark"
||
pathname
===
"/news"
?
LogoWhite
:
Logo
}
onClick=
{
()
=>
navigate
(
"/"
)
}
className=
" cursor-pointer"
/>
</
div
>
</
div
>
<
div
className=
"right content-1-cn items-start flex gap-x-12"
>
<
div
className=
"right content-1-cn items-start flex gap-x-12"
>
<
Link
<
Link
...
...
src/store/AppProvider.tsx
View file @
59375d7b
...
@@ -38,19 +38,20 @@ const AppReducer = (state:typeof data,action:Actions)=>{
...
@@ -38,19 +38,20 @@ const AppReducer = (state:typeof data,action:Actions)=>{
export
const
AppProvider
=
(
props
:
any
)
=>
{
export
const
AppProvider
=
(
props
:
any
)
=>
{
const
[
state
,
dispatch
]
=
useReducer
(
AppReducer
,
data
)
const
[
state
,
dispatch
]
=
useReducer
(
AppReducer
,
data
)
const
location
=
useLocation
()
const
location
=
useLocation
()
const
ob
=
fromEvent
(
window
,
'resize'
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
({
type
:
'routerOnChange'
,
payload
:{
currentPage
:
location
.
pathname
}})
dispatch
({
type
:
'routerOnChange'
,
payload
:{
currentPage
:
location
.
pathname
}})
dispatch
({
type
:
'slideOnChange'
,
payload
:{
pageIndex
:
0
}})
dispatch
({
type
:
'slideOnChange'
,
payload
:{
pageIndex
:
0
}})
},[
location
])
},[
location
])
useEffect
(()
=>
{
useEffect
(()
=>
{
const
ob
=
fromEvent
(
window
,
'resize'
)
ob
.
subscribe
(
v
=>
{
//
ob.subscribe(v=>{
const
target
=
v
.
currentTarget
//
const target = v.currentTarget
if
(
target
){
//
if(target){
console
.
log
(
target
);
//
console.log(target);
}
//
}
})
//
})
})
})
return
(
return
(
<
AppContext
.
Provider
value=
{
{
data
:
state
,
dispatch
}
}
>
<
AppContext
.
Provider
value=
{
{
data
:
state
,
dispatch
}
}
>
...
...
src/views/News/NewsDetails.tsx
View file @
59375d7b
...
@@ -48,7 +48,12 @@ export const NewsDetails = (props:NewsDetailsType)=>{
...
@@ -48,7 +48,12 @@ export const NewsDetails = (props:NewsDetailsType)=>{
<
PageLayout
className=
" overflow-y-scroll"
>
<
PageLayout
className=
" overflow-y-scroll"
>
<
AppContianer
>
<
AppContianer
>
<>
<>
<
div
className=
"flex"
>
<
div
className=
"w-2/12"
></
div
>
<
div
className=
'title-1-cn '
>
{
data
&&
data
.
title
}
</
div
>
<
div
className=
'w-[370px]'
></
div
>
</
div
>
<
div
className=
"flex normal-text "
>
<
div
className=
"flex normal-text "
>
<
div
className=
"w-2/12 pt-[35px]"
>
<
div
className=
"w-2/12 pt-[35px]"
>
<
div
className=
'flex-col pr-5 text-center '
>
<
div
className=
'flex-col pr-5 text-center '
>
...
@@ -71,7 +76,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
...
@@ -71,7 +76,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
</
div
>
</
div
>
<
div
>
<
div
>
<
div
className=
'richRender pt-5 px-20 pb-24'
>
<
div
className=
'richRender pt-5 px-20 pb-24'
>
<
div
className=
'title-1-cn py-[24px]'
>
{
data
&&
data
.
title
}
</
div
>
<
div
dangerouslySetInnerHTML=
{
{
__html
:
data
&&
data
.
content
}
}
className=
"py-5"
></
div
>
<
div
dangerouslySetInnerHTML=
{
{
__html
:
data
&&
data
.
content
}
}
className=
"py-5"
></
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -81,7 +86,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
...
@@ -81,7 +86,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
<
div
>
<
div
>
{
{
latestNews
&&
latestNews
.
map
((
k
:
any
,
index
:
number
)
=>
(
latestNews
&&
latestNews
.
map
((
k
:
any
,
index
:
number
)
=>
(
<
div
key=
{
index
}
onClick=
{
()
=>
navigate
(
`/news/${k.id}`
)
}
className=
"pb-[21px] w-[3
7
0px] normal-content cursor-pointer hover:text-theme-blue"
>
<
div
key=
{
index
}
onClick=
{
()
=>
navigate
(
`/news/${k.id}`
)
}
className=
"pb-[21px] w-[30px] normal-content cursor-pointer hover:text-theme-blue"
>
<
div
>
{
k
.
title
}
</
div
>
<
div
>
{
k
.
title
}
</
div
>
<
div
>
{
useDate
(
data
&&
data
.
time_stamp
).
year
}
/
{
useDate
(
data
&&
data
.
time_stamp
).
month
}
/
{
useDate
(
data
&&
data
.
time_stamp
).
day
}
</
div
>
<
div
>
{
useDate
(
data
&&
data
.
time_stamp
).
year
}
/
{
useDate
(
data
&&
data
.
time_stamp
).
month
}
/
{
useDate
(
data
&&
data
.
time_stamp
).
day
}
</
div
>
</
div
>
</
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