Skip to content

Commit

Permalink
feat: integrate kennisartikel-category into overige api
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 committed Nov 25, 2024
1 parent adf008a commit 9096c3d
Show file tree
Hide file tree
Showing 15 changed files with 804 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,5 @@ dist/
############################
# overige-objecten-api
############################
apps/overige-objecten-api/src/types
apps/overige-objecten-api/src/types
output-html
6 changes: 5 additions & 1 deletion apps/overige-objecten-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
"js-yaml": "4.1.0",
"swagger-ui-express": "5.0.1",
"lodash.merge": "4.6.2",
"lodash.snakecase": "4.1.1"
"lodash.snakecase": "4.1.1",
"react": "18.2.0",
"@utrecht/web-component-library-react": "3.0.0",
"@utrecht/component-library-react": "7.3.5",
"@frameless/ui": "0.1.0"
},
"devDependencies": {
"@types/cors": "2.8.17",
Expand Down
17 changes: 17 additions & 0 deletions apps/overige-objecten-api/src/components/AccordionSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { Markdown } from './Markdown';

export interface AccordionSectionProps {
label: string;
body: string;
headingLevel: number;
}
export const AccordionSection = ({ body, headingLevel = 2, label }: AccordionSectionProps) => {
const CustomHeading = `h${headingLevel}` as keyof React.JSX.IntrinsicElements;
return (
<div>
<CustomHeading>{label}</CustomHeading>
<Markdown>{body}</Markdown>
</div>
);
};
5 changes: 5 additions & 0 deletions apps/overige-objecten-api/src/components/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import xss from 'xss';

export const Markdown = ({ children }: { children: string }) =>
children ? <div dangerouslySetInnerHTML={{ __html: xss(children) }} /> : null;
227 changes: 212 additions & 15 deletions apps/overige-objecten-api/src/queries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,127 @@ query getAllProducts(
description
}
sections {
... on ComponentComponentsInternalBlockContent {
component: __typename
internal_field {
data {
attributes {
content {
uuid
contentBlock {
content
kennisartikelCategorie
}
}
}
}
}
}
... on ComponentComponentsUtrechtRichText {
id
content
kennisartikelCategorie
component: __typename
}
... on ComponentComponentsInternalBlockContent {
... on ComponentComponentsUtrechtImage {
component: __typename
internal_field {
categorie2:kennisartikelCategorie
imageData {
data {
attributes {
content {
uuid
contentBlock {
content
kennisartikelCategorie
}
name
alternativeText
caption
width
height
formats
url
}
}
}
}
... on ComponentComponentsUtrechtLogoButton {
component: __typename
categorie3:kennisartikelCategorie
appearance
href
label
logo
openFormsEmbed
textContent
}
... on ComponentComponentsUtrechtSpotlight {
component: __typename
categorie4:kennisartikelCategorie
content
type
logoButton {
id
label
href
textContent
logo
appearance
__typename
}
}
... on ComponentComponentsUtrechtRichText {
component: __typename
categorie5:kennisartikelCategorie
content
}
... on ComponentComponentsUtrechtMultiColumnsButton {
component: __typename
categorie6:kennisartikelCategorie
column {
id
title
logoButton {
component: __typename
appearance
href
label
logo
openFormsEmbed
textContent
}
}
}
... on ComponentComponentsUtrechtLink {
component: __typename
categorie7:kennisartikelCategorie
href
textContent
icon
language
}
... on ComponentComponentsFaq {
component: __typename
categorie8:kennisartikelCategorie
pdc_faq {
data {
attributes {
title
faq(pagination: { start: 0, limit: -1 }) {
body
headingLevel
id
label
}
}
}
}
}
... on ComponentComponentsUtrechtAccordion {
component: __typename
categorie9:kennisartikelCategorie
item(pagination: { start: 0, limit: -1 }) {
body
headingLevel
id
label
}
}
}
kennisartikelMetadata {
uuid
Expand All @@ -83,7 +182,6 @@ query getAllProducts(
}
}
}
`);

export const GET_PRODUCT_BY_UUID = gql(`
Expand All @@ -108,12 +206,6 @@ export const GET_PRODUCT_BY_UUID = gql(`
description
}
sections {
... on ComponentComponentsUtrechtRichText {
id
content
kennisartikelCategorie
component:__typename
}
... on ComponentComponentsInternalBlockContent {
component: __typename
internal_field {
Expand All @@ -130,6 +222,111 @@ export const GET_PRODUCT_BY_UUID = gql(`
}
}
}
... on ComponentComponentsUtrechtRichText {
id
content
kennisartikelCategorie
component: __typename
}
... on ComponentComponentsUtrechtImage {
component: __typename
categorie2:kennisartikelCategorie
imageData {
data {
attributes {
name
alternativeText
caption
width
height
formats
url
}
}
}
}
... on ComponentComponentsUtrechtLogoButton {
component: __typename
categorie3:kennisartikelCategorie
appearance
href
label
logo
openFormsEmbed
textContent
}
... on ComponentComponentsUtrechtSpotlight {
component: __typename
categorie4:kennisartikelCategorie
content
type
logoButton {
id
label
href
textContent
logo
appearance
__typename
}
}
... on ComponentComponentsUtrechtRichText {
component: __typename
categorie5:kennisartikelCategorie
content
}
... on ComponentComponentsUtrechtMultiColumnsButton {
component: __typename
categorie6:kennisartikelCategorie
column {
id
title
logoButton {
component: __typename
appearance
href
label
logo
openFormsEmbed
textContent
}
}
}
... on ComponentComponentsUtrechtLink {
component: __typename
categorie7:kennisartikelCategorie
href
textContent
icon
language
}
... on ComponentComponentsFaq {
component: __typename
categorie8:kennisartikelCategorie
pdc_faq {
data {
attributes {
title
faq(pagination: { start: 0, limit: -1 }) {
body
headingLevel
id
label
}
}
}
}
}
... on ComponentComponentsUtrechtAccordion {
component: __typename
categorie9:kennisartikelCategorie
item(pagination: { start: 0, limit: -1 }) {
body
headingLevel
id
label
}
}
}
kennisartikelMetadata {
uuid
Expand Down
Loading

0 comments on commit 9096c3d

Please sign in to comment.