Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/XW-83/Github-issues #98

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pwa/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ module.exports = {
separator: ".",
},
autoGenHomeLabel: "Home",
crumbLabelUpdates: [
{
pathname: "/[id]",
crumbLabel: "Details page",
},
],
},
},
],
Expand Down
35 changes: 13 additions & 22 deletions pwa/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"private": true,
"description": "Product Website Template",
"author": "Conduction",
"keywords": ["gatsby"],
"keywords": [
"gatsby"
],
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
Expand All @@ -23,7 +25,7 @@
},
"dependencies": {
"@conduction/components": "2.2.8",
"@conduction/theme": "1.0.36",
"@conduction/theme": "1.0.44",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.1.18",
Expand Down
7 changes: 0 additions & 7 deletions pwa/src/components/ParsedHTML/ParsedHTML.module.css

This file was deleted.

42 changes: 0 additions & 42 deletions pwa/src/components/ParsedHTML/ParsedHTML.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faGripVertical, faTable } from "@fortawesome/free-solid-svg-icons";
import { useDisplayContext } from "../../context/displays";
import { Button, ButtonGroup } from "@utrecht/component-library-react/dist/css-module";
import { useTranslation } from "react-i18next";

interface ResultsDisplaySwitchProps {
displayKey: string; // should implement with an unique key
Expand All @@ -13,23 +14,26 @@ interface ResultsDisplaySwitchProps {

const ResultsDisplaySwitch: React.FC<ResultsDisplaySwitchProps> = ({ layoutClassName, displayKey }) => {
const { setDisplay, isActive } = useDisplayContext();
const { t } = useTranslation();

return (
<ButtonGroup className={clsx(styles.container, layoutClassName && layoutClassName)}>
<Button
appearance={isActive(displayKey, "cards") ? "primary-action-button" : "secondary-action-button"}
className={styles.button}
onClick={() => setDisplay({ [displayKey]: "cards" })}
discription={t("Show cards")}
>
<FontAwesomeIcon icon={faGripVertical} /> Tegels
<FontAwesomeIcon icon={faGripVertical} /> {t("Cards")}
</Button>

<Button
appearance={isActive(displayKey, "table") ? "primary-action-button" : "secondary-action-button"}
className={styles.button}
onClick={() => setDisplay({ [displayKey]: "table" })}
discription={t("Show table")}
>
<FontAwesomeIcon icon={faTable} /> Tabel
<FontAwesomeIcon icon={faTable} /> {t("Table")}
</Button>
</ButtonGroup>
);
Expand Down
14 changes: 11 additions & 3 deletions pwa/src/layout/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ import "../styling/index.css";
import { Helmet } from "react-helmet";
import { getPageTitle } from "../services/getPageTitle";
import { useGatsbyContext } from "../context/gatsby";
import { useTranslation } from "react-i18next";

export const Head: React.FC = () => {
const { gatsbyContext } = useGatsbyContext();
const { t, i18n } = useTranslation();

const translatedCrumbs = gatsbyContext.pageContext?.breadcrumb.crumbs.map((crumb: any) => ({
...crumb,
crumbLabel: t(_.upperFirst(crumb.crumbLabel)),
}));

return (
<Helmet
htmlAttributes={{
lang: i18n.language,
}}
bodyAttributes={{
class: process.env.GATSBY_NL_DESIGN_THEME_CLASSNAME,
}}
>
<title>{`Woo | ${
getPageTitle(gatsbyContext.pageContext?.breadcrumb.crumbs, gatsbyContext.location) ?? "Error"
}`}</title>
<title>{`Woo | ${getPageTitle(translatedCrumbs, gatsbyContext.location) ?? "Error"}`}</title>
<link rel="icon" type="svg" href={process.env.GATSBY_FAVICON_URL} />
</Helmet>
);
Expand Down
4 changes: 4 additions & 0 deletions pwa/src/styling/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ html,
body {
margin: 0;
}

.utrecht-link > svg {
margin-inline-end: var(--utrecht-icon-gap);
}
2 changes: 2 additions & 0 deletions pwa/src/styling/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
@import "../../node_modules/@conduction/theme/municipalities/noordwijk-design-tokens/dist/index.css";
@import "../../node_modules/@conduction/theme/municipalities/noaberkracht-design-tokens/dist/index.css";
@import "../../node_modules/@conduction/theme/municipalities/rotterdam-design-tokens/dist/index.css";
@import "../../node_modules/@conduction/theme/municipalities/open-webconcept-design-tokens/dist/index.css";
@import "../../node_modules/@conduction/theme/municipalities/dimpact-design-tokens/dist/index.css";

/* Design Tokens maintained by Frameless */
@import "../../node_modules/@utrecht/design-tokens/dist/theme.css";
Expand Down
9 changes: 7 additions & 2 deletions pwa/src/templates/jumbotronTemplate/JumbotronTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@ import * as React from "react";
import * as styles from "./JumbotronTemplate.module.css";
import { Heading2, Paragraph, Page, PageContent } from "@utrecht/component-library-react/dist/css-module";
import { CardWrapper } from "@conduction/components/lib/components/card";
import { useTranslation } from "react-i18next";

export const JumbotronTemplate: React.FC = () => {
const { t } = useTranslation();

return (
<div style={{ backgroundImage: `url(${process.env.GATSBY_JUMBOTRON_IMAGE_URL})` }} className={styles.wrapper}>
<Page>
<PageContent>
<div>
<CardWrapper className={styles.card}>
<Heading2 className={styles.title}>Woo-publicaties van {process.env.GATSBY_ORGANISATION_NAME}</Heading2>
<Heading2 className={styles.title}>
{t("Woo-publications of")} {process.env.GATSBY_ORGANISATION_NAME}
</Heading2>

<Paragraph className={styles.description}>
Op deze pagina vindt u de Woo-publicaties van {process.env.GATSBY_ORGANISATION_NAME}
{t("On this page you will find the Woo-publications of")} {process.env.GATSBY_ORGANISATION_NAME}
</Paragraph>
</CardWrapper>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as React from "react";
import * as styles from "./CardsResultsTemplate.module.css";
import { Heading2, Paragraph } from "@utrecht/component-library-react/dist/css-module";
import { faClock } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { translateDate } from "../../../services/dateFormat";
import { useTranslation } from "react-i18next";
import { navigate } from "gatsby";
Expand All @@ -13,7 +11,7 @@ interface CardsResultsTemplateProps {
}

export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requests }) => {
const { i18n } = useTranslation();
const { t, i18n } = useTranslation();

return (
<>
Expand All @@ -22,11 +20,10 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
<CardWrapper key={request.id} className={styles.cardContainer} onClick={() => navigate(request.id)}>
<CardHeader>
<CardHeaderDate>
<FontAwesomeIcon icon={faClock} />{" "}
{request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : "N.v.t."}
{request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")}
</CardHeaderDate>
<CardHeaderTitle className={styles.title}>
<Heading2>{request.Titel ?? "Geen titel beschikbaar"}</Heading2>
<Heading2>{request.Titel ?? t("No title available")}</Heading2>
</CardHeaderTitle>
</CardHeader>

Expand Down
17 changes: 11 additions & 6 deletions pwa/src/templates/templateParts/filters/FiltersTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faMagnifyingGlass, faSpinner } from "@fortawesome/free-solid-svg-icons";
import { generateYearsArray } from "../../../data/years";
import { TEMP_PUBLICATION_TYPES } from "../../../data/PublicationType";
import { useTranslation } from "react-i18next";

interface FiltersTemplateProps {
isLoading: boolean;
}

export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) => {
const { filters, setFilters } = useFiltersContext();
const { t } = useTranslation();
const filterTimeout = React.useRef<NodeJS.Timeout | null>(null);

const {
Expand Down Expand Up @@ -49,27 +51,30 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) =
return (
<div className={styles.container}>
<form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
<InputText name="title" placeholder="Zoeken.." defaultValue={filters._search} {...{ register, errors }} />

<InputText
name="title"
placeholder={`${t("Search")}..`}
defaultValue={filters._search}
{...{ register, errors }}
/>
<SelectSingle
options={generateYearsArray(currentYear - 1995)}
name="year"
placeholder="Jaar"
placeholder={t("Year")}
isClearable
{...{ register, errors, control }}
/>

<SelectSingle
options={TEMP_PUBLICATION_TYPES}
name="category"
placeholder="Categorie"
placeholder={t("Category")}
defaultValue={TEMP_PUBLICATION_TYPES.find((option) => option.value === filters.Categorie)}
isClearable
{...{ register, errors, control }}
/>

<Button type="submit" className={styles.button} disabled={isLoading}>
<FontAwesomeIcon icon={!isLoading ? faMagnifyingGlass : faSpinner} /> {!isLoading && "Zoeken"}
<FontAwesomeIcon icon={!isLoading ? faMagnifyingGlass : faSpinner} /> {!isLoading && t("Search")}
</Button>
</form>

Expand Down
Loading