aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/page/page-layout.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-16 19:40:23 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-16 19:40:23 +0200
commitc77c58e18143233be042c4980a6ed08ae9beac52 (patch)
tree94f7d828571a86470ae299fff7dffd32fb38de7c /src/components/templates/page/page-layout.tsx
parent2155550fa36a3bc3c8f66e0926530123b4018cd4 (diff)
chore: adjust and complete missing styles
* add logo to topics pages and links * add Prism styles to articles * and a few other adjustements
Diffstat (limited to 'src/components/templates/page/page-layout.tsx')
-rw-r--r--src/components/templates/page/page-layout.tsx17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/components/templates/page/page-layout.tsx b/src/components/templates/page/page-layout.tsx
index bc90f4c..f3f3ea8 100644
--- a/src/components/templates/page/page-layout.tsx
+++ b/src/components/templates/page/page-layout.tsx
@@ -20,7 +20,7 @@ import TableOfContents from '@components/organisms/widgets/table-of-contents';
import { type SendCommentVars } from '@services/graphql/api';
import { sendComment } from '@services/graphql/comments';
import useIsMounted from '@utils/hooks/use-is-mounted';
-import { FC, ReactNode, useRef, useState } from 'react';
+import { FC, HTMLAttributes, ReactNode, useRef, useState } from 'react';
import { useIntl } from 'react-intl';
import Layout, { type LayoutProps } from '../layout/layout';
import styles from './page-layout.module.scss';
@@ -33,6 +33,11 @@ export type PageLayoutProps = Pick<
* True if the page accepts new comments. Default: false.
*/
allowComments?: boolean;
+ bodyAttributes?: HTMLAttributes<HTMLDivElement>;
+ /**
+ * Set additional classnames to the body wrapper.
+ */
+ bodyClassName?: string;
/**
* The breadcrumb items.
*/
@@ -83,6 +88,8 @@ export type PageLayoutProps = Pick<
const PageLayout: FC<PageLayoutProps> = ({
children,
allowComments = false,
+ bodyAttributes,
+ bodyClassName = '',
breadcrumb,
breadcrumbSchema,
comments,
@@ -91,8 +98,8 @@ const PageLayout: FC<PageLayoutProps> = ({
id,
intro,
isHome = false,
- widgets,
title,
+ widgets,
withToC = false,
}) => {
const intl = useIntl();
@@ -202,11 +209,12 @@ const PageLayout: FC<PageLayoutProps> = ({
{typeof children === 'string' ? (
<div
ref={bodyRef}
- className={styles.body}
+ className={`${styles.body} ${bodyClassName}`}
dangerouslySetInnerHTML={{ __html: children }}
+ {...bodyAttributes}
/>
) : (
- <div ref={bodyRef} className={styles.body}>
+ <div ref={bodyRef} className={`${styles.body} ${bodyClassName}`}>
{children}
</div>
)}
@@ -245,6 +253,7 @@ const PageLayout: FC<PageLayoutProps> = ({
{allowComments && (
<section className={styles.comments__section}>
<CommentForm
+ className={styles.comments__form}
saveComment={saveComment}
title={commentFormTitle}
Notice={