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

add badge, date, export utils (v0.7.9)

parent 3c030205
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -21,6 +21,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## [0.7.9] - 2023-05-12
### Added
- Card badge and date
- Format date in news
- export utils (isArray, isBoolean, isObject, isString, merge)
## [0.7.8] - 2023-05-10 ## [0.7.8] - 2023-05-10
### Fixed ### Fixed
......
...@@ -64,5 +64,7 @@ export { default as Marquee } from "./src/components/core/Marquee" ...@@ -64,5 +64,7 @@ export { default as Marquee } from "./src/components/core/Marquee"
// Text component // Text component
export { default as Text } from "./src/components/Text" export { default as Text } from "./src/components/Text"
export { isArray, isBoolean, isObject, isString, merge } from "./src/utils"
//Page context //Page context
export { usePageContext } from "./src/context/page" export { usePageContext } from "./src/context/page"
...@@ -156,6 +156,7 @@ const Section = (props: ISection) => { ...@@ -156,6 +156,7 @@ const Section = (props: ISection) => {
> >
{section.components.map((component) => { {section.components.map((component) => {
const dtComponent = component.components_id const dtComponent = component.components_id
if (!dtComponent) return null
return ( return (
<React.Fragment key={dtComponent.id}> <React.Fragment key={dtComponent.id}>
......
...@@ -4,14 +4,18 @@ export const isString = (val) => { ...@@ -4,14 +4,18 @@ export const isString = (val) => {
return Object.prototype.toString.call(val) === "[object String]" return Object.prototype.toString.call(val) === "[object String]"
} }
export const isArray = (obj) => {
return Object.prototype.toString.call(obj) === "[object Array]"
}
export const isObject = (obj) => { export const isObject = (obj) => {
return Object.prototype.toString.call(obj) === "[object Object]" return Object.prototype.toString.call(obj) === "[object Object]"
} }
// Thanks ChatGPT ;) // Thanks ChatGPT ;)
export const merge = (obj1: object, obj2: object): object => { export const merge = (obj1: object, obj2: object): object => {
if(!obj1) return obj2 if (!obj1) return obj2
if(!obj2) return obj1 if (!obj2) return obj1
for (let key in obj2) { for (let key in obj2) {
if (obj2.hasOwnProperty(key)) { if (obj2.hasOwnProperty(key)) {
......
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