diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-16 19:40:23 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-16 19:40:23 +0200 |
| commit | c77c58e18143233be042c4980a6ed08ae9beac52 (patch) | |
| tree | 94f7d828571a86470ae299fff7dffd32fb38de7c /src/components/templates/page | |
| parent | 2155550fa36a3bc3c8f66e0926530123b4018cd4 (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')
| -rw-r--r-- | src/components/templates/page/page-layout.module.scss | 6 | ||||
| -rw-r--r-- | src/components/templates/page/page-layout.stories.tsx | 2 | ||||
| -rw-r--r-- | src/components/templates/page/page-layout.tsx | 17 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/components/templates/page/page-layout.module.scss b/src/components/templates/page/page-layout.module.scss index 7602492..83e5a80 100644 --- a/src/components/templates/page/page-layout.module.scss +++ b/src/components/templates/page/page-layout.module.scss @@ -72,6 +72,7 @@ .footer { grid-column: 2; + margin: var(--spacing-sm) 0 var(--spacing-2xs); } .comments { @@ -87,4 +88,9 @@ grid-column: 2; margin: var(--spacing-md) 0 0; } + + &__form { + max-width: 40ch; + margin: auto; + } } diff --git a/src/components/templates/page/page-layout.stories.tsx b/src/components/templates/page/page-layout.stories.tsx index 002b951..8af5f98 100644 --- a/src/components/templates/page/page-layout.stories.tsx +++ b/src/components/templates/page/page-layout.stories.tsx @@ -473,7 +473,7 @@ export const Blog = Template.bind({}); Blog.args = { breadcrumb: postsListBreadcrumb, title: 'Blog', - headerMeta: { total: `${posts.length} posts` }, + headerMeta: { total: posts.length }, children: ( <> <PostsList posts={posts} byYear={true} total={posts.length} /> 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={ |
