From 7d9f874364ec6e255e62eb3027011bfed267904c Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 17 May 2022 18:37:38 +0200 Subject: chore: adjust articles styles * change animation on article card hover * change comments section alignment --- .../templates/page/page-layout.module.scss | 9 ++- src/components/templates/page/page-layout.tsx | 85 ++++++++++++++-------- 2 files changed, 61 insertions(+), 33 deletions(-) (limited to 'src/components/templates/page') diff --git a/src/components/templates/page/page-layout.module.scss b/src/components/templates/page/page-layout.module.scss index 83e5a80..c6b4e8d 100644 --- a/src/components/templates/page/page-layout.module.scss +++ b/src/components/templates/page/page-layout.module.scss @@ -86,7 +86,14 @@ &__section { grid-column: 2; - margin: var(--spacing-md) 0 0; + + &:first-child { + margin: var(--spacing-md) 0 0; + } + } + + &__no-comments { + text-align: center; } &__form { diff --git a/src/components/templates/page/page-layout.tsx b/src/components/templates/page/page-layout.tsx index f3f3ea8..2ff2084 100644 --- a/src/components/templates/page/page-layout.tsx +++ b/src/components/templates/page/page-layout.tsx @@ -1,6 +1,7 @@ import Heading from '@components/atoms/headings/heading'; import Notice, { type NoticeKind } from '@components/atoms/layout/notice'; import Sidebar from '@components/atoms/layout/sidebar'; +import { MetaData } from '@components/molecules/layout/meta'; import PageFooter, { type PageFooterProps, } from '@components/molecules/layout/page-footer'; @@ -118,10 +119,10 @@ const PageLayout: FC = ({ const isMounted = useIsMounted(bodyRef); const hasComments = Array.isArray(comments) && comments.length > 0; - const hasCommentsSection = hasComments || allowComments; - const articleModifier = hasCommentsSection - ? 'article--has-comments' - : 'article--no-comments'; + const articleModifier = + hasComments || allowComments + ? 'article--has-comments' + : 'article--no-comments'; const [status, setStatus] = useState('info'); const [statusMessage, setStatusMessage] = useState(''); @@ -175,6 +176,15 @@ const PageLayout: FC = ({ } }; + /** + * Check if meta properties are defined. + * + * @param {MetaData} meta - The metadata. + */ + const hasMeta = (meta: MetaData) => { + return Object.values(meta).every((value) => value === null); + }; + return ( = ({ {children} )} - + {footerMeta && hasMeta(footerMeta) && ( + + )} = ({ > {widgets} - {hasCommentsSection && ( -
- {hasComments && ( -
- {commentsTitle} + {allowComments && ( +
+
+ + {commentsTitle} + + {hasComments ? ( - ) : undefined + ) } saveComment={saveComment} /> -
- )} - {allowComments && ( -
- - ) : undefined - } - /> -
- )} + ) : ( +

+ {intl.formatMessage({ + defaultMessage: 'No comments.', + id: 'sBwfCy', + description: 'PageLayout: no comments text', + })} +

+ )} +
+
+ + ) + } + /> +
)}
-- cgit v1.2.3