Skip to content

Commit

Permalink
updated package.lock and added HorizontalOverflowWrapper to TableResu…
Browse files Browse the repository at this point in the history
…ltsTemplate
  • Loading branch information
remko48 committed Oct 17, 2023
1 parent f946269 commit 3356e0b
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 42 deletions.
40 changes: 27 additions & 13 deletions pwa/package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { navigate } from "gatsby";
import { translateDate } from "../../../services/dateFormat";
import { useTranslation } from "react-i18next";
import { HorizontalOverflowWrapper } from "@conduction/components";

interface TableResultsTemplateProps {
requests: any[];
Expand All @@ -20,35 +21,42 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
const { t, i18n } = useTranslation();

return (
<Table className={styles.table}>
<TableHeader className={styles.tableHeader}>
<TableRow>
<TableHeaderCell>{t("Subject")}</TableHeaderCell>
<TableHeaderCell>{t("Publication date")}</TableHeaderCell>
<TableHeaderCell>{t("Summary")}</TableHeaderCell>
</TableRow>
</TableHeader>
<TableBody className={styles.tableBody}>
{requests.map((request) => (
<TableRow
className={styles.tableRow}
key={request.id}
onClick={() => navigate(request.id)}
tabIndex={0}
aria-label={`${request.Titel}, ${
request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")
}, ${request.Samenvatting}`}
>
<TableCell>{request.Titel ?? t("No subject available")}</TableCell>
<TableCell>
{request.Publicatiedatum
? translateDate(i18n.language, request.Publicatiedatum)
: t("No publication date available")}
</TableCell>
<TableCell>{request.Samenvatting ?? t("No summary available")}</TableCell>
<HorizontalOverflowWrapper
ariaLabels={{
scrollLeftButton: t("Scroll table to the left"),
scrollRightButton: t("Scroll table to the right"),
}}
>
<Table className={styles.table}>
<TableHeader className={styles.tableHeader}>
<TableRow>
<TableHeaderCell>{t("Subject")}</TableHeaderCell>
<TableHeaderCell>{t("Publication date")}</TableHeaderCell>
<TableHeaderCell>{t("Summary")}</TableHeaderCell>
</TableRow>
))}
</TableBody>
</Table>
</TableHeader>
<TableBody className={styles.tableBody}>
{requests.map((request) => (
<TableRow
className={styles.tableRow}
key={request.id}
onClick={() => navigate(request.id)}
tabIndex={0}
aria-label={`${request.Titel}, ${
request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")
}, ${request.Samenvatting}`}
>
<TableCell>{request.Titel ?? t("No subject available")}</TableCell>
<TableCell>
{request.Publicatiedatum
? translateDate(i18n.language, request.Publicatiedatum)
: t("No publication date available")}
</TableCell>
<TableCell>{request.Samenvatting ?? t("No summary available")}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</HorizontalOverflowWrapper>
);
};
2 changes: 2 additions & 0 deletions pwa/src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ export const en = {
"Enter search query": "Enter search query",
"Results per page": "Results per page",
"Select result limit": "Select result limit",
"Scroll table to the left": "Scroll table to the left",
"Scroll table to the right": "Scroll table to the right",
};
2 changes: 2 additions & 0 deletions pwa/src/translations/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ export const nl = {
"Enter search query": "Voer zoekopdracht in",
"Results per page": "Resultaten per pagina",
"Select result limit": "Selecteer resultaten limiet",
"Scroll table to the left": "Scroll tabel naar links",
"Scroll table to the right": "Scroll tabel naar rechts",
};

0 comments on commit 3356e0b

Please sign in to comment.