Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gatsby Theme Onegeo
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OneGeo Suite
Libs
Gatsby Theme Onegeo
Commits
d51e851a
Commit
d51e851a
authored
1 year ago
by
Manoa Harinjo
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
https://git.neogeo.fr/onegeo-suite/libs/gatsby-theme-onegeo
into feat/menu
parents
1b81e181
d8771902
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.d.ts
+1
-0
1 addition, 0 deletions
index.d.ts
src/components/Maps.tsx
+45
-7
45 additions, 7 deletions
src/components/Maps.tsx
src/pages-doc/doc/maps.tsx
+1
-0
1 addition, 0 deletions
src/pages-doc/doc/maps.tsx
with
47 additions
and
7 deletions
index.d.ts
+
1
−
0
View file @
d51e851a
...
...
@@ -317,6 +317,7 @@ export function Component(props: IComponent): JSX.Element
interface
IMaps
{
layout
?:
"
row
"
|
"
col
"
|
"
grid
"
size
?:
"
xs
"
|
"
base
"
|
"
xl
"
format
?:
"
mapstore
"
|
"
maps
"
}
export
function
Maps
(
props
:
IMaps
):
JSX
.
Element
...
...
This diff is collapsed.
Click to expand it.
src/components/Maps.tsx
+
45
−
7
View file @
d51e851a
...
...
@@ -16,6 +16,7 @@ interface IMaps {
classname
?:
string
}
options
?:
object
format
?:
"
mapstore
"
|
"
maps
"
}
const
Maps
=
(
props
:
IMaps
)
=>
{
...
...
@@ -26,6 +27,7 @@ const Maps = (props: IMaps) => {
layout
=
"
row
"
,
size
=
"
xs
"
,
limit
=
3
,
format
=
"
maps
"
,
}
=
props
const
options
=
props
.
options
??
{}
...
...
@@ -33,11 +35,10 @@ const Maps = (props: IMaps) => {
const
[
data
,
setData
]
=
useState
([])
const
MAPS_URL
=
"
/geoportal/rest/geostore/extjs/search/category/MAP/***/thumbnail,details,featured?includeAttributes=true
"
const
mapsUrl
=
getMapsUrl
(
format
,
limit
)
useEffect
(()
=>
{
fetch
(
`
${
MAPS_URL
}
&start=0&limit=
${
limit
}
`
)
fetch
(
mapsUrl
)
.
then
((
res
)
=>
{
if
(
!
res
.
ok
)
{
throw
new
Error
(
res
.
statusText
)
...
...
@@ -59,14 +60,13 @@ const Maps = (props: IMaps) => {
if
(
!
data
.
length
)
return
null
const
dataCards
=
data
.
map
((
data
:
any
)
=>
{
let
oData
=
getDataCardsByFormat
(
data
,
format
)
return
{
name
:
data
.
name
,
description
:
data
.
description
,
image
:
`/geoportal/
${
data
.
thumbnail
}
`
,
size
:
size
,
url
:
`/geoportal/#/context/Admin/
${
data
.
id
}
`
,
anime
:
anime
||
options
.
anime
,
options
:
options
.
card
,
...
oData
,
}
})
...
...
@@ -87,4 +87,42 @@ const Maps = (props: IMaps) => {
)
}
const
isFormatMaps
=
(
format
:
string
)
=>
{
return
format
==
"
maps
"
}
const
getMapsUrl
=
(
format
:
string
,
limit
:
number
)
=>
{
let
url
if
(
isFormatMaps
(
format
))
{
url
=
`/fr/maps/maps/?format=json&q=&highlight=true&page=1&page_size=
${
limit
}
`
}
else
{
url
=
`/geoportal/rest/geostore/extjs/search/category/MAP/***/thumbnail,details,featured?includeAttributes=true&start=0&limit=
${
limit
}
`
}
return
url
}
const
getDataCardsByFormat
=
(
data
:
any
,
format
:
string
)
=>
{
let
oData
if
(
isFormatMaps
(
format
))
{
oData
=
{
name
:
data
.
display_name
,
description
:
data
.
description
,
image
:
data
.
thumbnail
.
url
,
url
:
`/maps/#/map/
${
data
.
id
}
`
,
}
}
else
{
oData
=
{
name
:
data
.
name
,
description
:
data
.
description
,
image
:
`/geoportal/
${
data
.
thumbnail
}
`
,
url
:
`/geoportal/#/context/Admin/
${
data
.
id
}
`
,
}
}
return
oData
}
export
default
Maps
This diff is collapsed.
Click to expand it.
src/pages-doc/doc/maps.tsx
+
1
−
0
View file @
d51e851a
...
...
@@ -17,6 +17,7 @@ interface IMaps {
layout?: "row" | "col" | "grid"
size?: "xs" | "base" | "xl"
limit?: number
format?: "mapstore" | "maps"
}
`
}
</
code
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment