Skip to content
Snippets Groups Projects
Commit 9b7f85d4 authored by Julien MARGAIL's avatar Julien MARGAIL
Browse files

customComponent & fix menu (v0.7.7)

parent 3e4db076
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -21,6 +21,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## [0.7.7] - 2023-05-05
- require Datamodel >= 0.6.0
### Added
- PageContext
- Use Theme in Layout (and pages...)
- options props in pages, index
- customComponent to simplify extending theme in portal fork
### Fixed
- Menu unique key
## [0.7.6] - 2023-04-21 ## [0.7.6] - 2023-04-21
### Added ### Added
......
...@@ -21,6 +21,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -21,6 +21,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## [0.6.1] - 2023-05-05
categories
- add label
## [0.6.0] - 2023-04-13 ## [0.6.0] - 2023-04-13
site site
......
...@@ -162,5 +162,13 @@ module.exports = { ...@@ -162,5 +162,13 @@ module.exports = {
secure: false, secure: false,
}) })
) )
app.use(
"/fr/",
proxy.createProxyMiddleware("/fr/", {
target: PF_URL,
secure: false,
})
)
}, },
} }
...@@ -267,6 +267,47 @@ interface ISections { ...@@ -267,6 +267,47 @@ interface ISections {
ids: string[] ids: string[]
} }
export function Sections(props: ISections): JSX.Element export function Sections(props: ISections): JSX.Element
export interface IAction {
actions_id: {
name: string
url: string
style: string
}
}
export interface IService {
services_id: {
name: string
url: string
description: string
image: {
imageFile?: {
publicURL?: string
}
}
options: any
}
}
export interface IComponent {
type: string
actions: IAction[] | []
mapdid: string
title: string
subtitle: string
content: string
url_dataviz: string
url_map: string
layout: string
length: number
size: string
services: IService[] | []
images: Iimage[] | []
options: any
}
export function Component(props: IComponent): JSX.Element
interface IMaps { interface IMaps {
layout?: "row" | "col" | "grid" layout?: "row" | "col" | "grid"
size?: "xs" | "base" | "xl" size?: "xs" | "base" | "xl"
......
...@@ -13,7 +13,7 @@ export { default as Badge } from "./src/components/core/Badge" ...@@ -13,7 +13,7 @@ export { default as Badge } from "./src/components/core/Badge"
export { default as Toc } from "./src/components/core/Toc" export { default as Toc } from "./src/components/core/Toc"
export { default as Footer } from "./src/components/Footer" export { default as Footer } from "./src/components/Footer"
export { default as Map } from "./src/components/core/Map" export { default as Map } from "./src/components/core/Map"
export { default as Image, Iimage } from "./src/components/core/Image" export { default as Image } from "./src/components/core/Image"
export { default as Stats } from "./src/components/Stats" export { default as Stats } from "./src/components/Stats"
export { default as CardList } from "./src/components/core/CardList" export { default as CardList } from "./src/components/core/CardList"
export { default as TitleComponent } from "./src/components/core/TitleComponent" export { default as TitleComponent } from "./src/components/core/TitleComponent"
...@@ -51,6 +51,7 @@ export { default as Data } from "./src/components/Data" ...@@ -51,6 +51,7 @@ export { default as Data } from "./src/components/Data"
// Section components // Section components
export { default as Sections } from "./src/components/Sections" export { default as Sections } from "./src/components/Sections"
export { default as Component } from "./src/components/section/component"
// Maps components // Maps components
export { default as Maps } from "./src/components/Maps" export { default as Maps } from "./src/components/Maps"
......
{ {
"name": "@onegeo-suite/gatsby-theme-onegeo", "name": "@onegeo-suite/gatsby-theme-onegeo",
"version": "0.7.6", "version": "0.7.7",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"author": "NEOGEO", "author": "NEOGEO",
"license": "MIT", "license": "MIT",
"onegeosuite": { "onegeosuite": {
"portal": { "portal": {
"datamodel": ">=0.5.0" "datamodel": ">=0.6.0"
} }
}, },
"peerDependencies": { "peerDependencies": {
......
...@@ -68,7 +68,7 @@ const Menu = (props: Imenu) => { ...@@ -68,7 +68,7 @@ const Menu = (props: Imenu) => {
<ul className="bg-base-100 z-50 p-2 shadow-md"> <ul className="bg-base-100 z-50 p-2 shadow-md">
{item.children.map((itemChild: any, idx: number) => { {item.children.map((itemChild: any, idx: number) => {
return ( return (
<li key={idx}> <li key={"M_" + name + "_L2_" + idx}>
<Link to={goto(itemChild)} target="_blank"> <Link to={goto(itemChild)} target="_blank">
<span>{itemChild.name}</span> <span>{itemChild.name}</span>
</Link> </Link>
...@@ -84,7 +84,7 @@ const Menu = (props: Imenu) => { ...@@ -84,7 +84,7 @@ const Menu = (props: Imenu) => {
<ul className="menu bg-base-100 rounded-box z-50 min-w-[12rem] p-2 shadow-md"> <ul className="menu bg-base-100 rounded-box z-50 min-w-[12rem] p-2 shadow-md">
{item.children.map((itemChild: any, idx: number) => { {item.children.map((itemChild: any, idx: number) => {
return ( return (
<li key={idx}> <li key={"M_" + name + "_L1_" + idx}>
<Link to={goto(itemChild)} target="_blank"> <Link to={goto(itemChild)} target="_blank">
<span className="grow">{itemChild.name}</span> <span className="grow">{itemChild.name}</span>
{itemChild?.children.length > 0 && ( {itemChild?.children.length > 0 && (
...@@ -106,7 +106,7 @@ const Menu = (props: Imenu) => { ...@@ -106,7 +106,7 @@ const Menu = (props: Imenu) => {
<ul className={className}> <ul className={className}>
{menu?.map((item: any, key: number) => { {menu?.map((item: any, key: number) => {
return ( return (
<li key={key}> <li key={"M_" + name + "_L0_" + key}>
<Link to={goto(item)} target="_blank"> <Link to={goto(item)} target="_blank">
<span>{item.name}</span> <span>{item.name}</span>
{item?.children.length > 0 && ( {item?.children.length > 0 && (
......
import React from "react" import React from "react"
import { IGatsbyImageData } from "gatsby-plugin-image" import { IGatsbyImageData } from "gatsby-plugin-image"
import CustomComponent from "./customComponent"
import Map from "../core/Map" import Map from "../core/Map"
import News from "../News" import News from "../News"
...@@ -14,7 +15,7 @@ import Iframe from "../core/Iframe" ...@@ -14,7 +15,7 @@ import Iframe from "../core/Iframe"
import Text from "../Text" import Text from "../Text"
import Partners from "../Partners" import Partners from "../Partners"
interface IAction { export interface IAction {
actions_id: { actions_id: {
name: string name: string
url: string url: string
...@@ -22,7 +23,7 @@ interface IAction { ...@@ -22,7 +23,7 @@ interface IAction {
} }
} }
interface IService { export interface IService {
services_id: { services_id: {
name: string name: string
url: string url: string
...@@ -36,13 +37,13 @@ interface IService { ...@@ -36,13 +37,13 @@ interface IService {
} }
} }
interface Iimage { export interface Iimage {
directus_files_id: { directus_files_id: {
imageFile: IGatsbyImageData imageFile: IGatsbyImageData
} }
} }
interface IComponent { export interface IComponent {
type: string type: string
actions: IAction[] | [] actions: IAction[] | []
mapdid: string mapdid: string
...@@ -176,7 +177,7 @@ const Component = (props: IComponent) => { ...@@ -176,7 +177,7 @@ const Component = (props: IComponent) => {
return <Partners /> return <Partners />
} }
return <div></div> return <CustomComponent {...props} />
} }
export default Component export default Component
// To be overriden in Portal
// Allow adding custom Component in project, need to add the new component type in Directus
// and register this new component here in order to use it
import React from "react"
import { IComponent } from "@onegeo-suite/gatsby-theme-onegeo"
// Import the custom Component
//// import MyComponent from "../MyComponent"
const CustomComponent = (props: IComponent) => {
const {
type,
// ...restProps
} = props
switch (type) {
// Use the 'type' added in Directus
case "mycomponent":
// Use the custom component
return <></>
}
return <></>
}
export default CustomComponent
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment