summaryrefslogtreecommitdiffstats
path: root/src/components/molecules/layout/card.module.scss
blob: d5b983668c2f517cf90f00bb5cf872077417e6c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@use "@styles/abstracts/functions" as fun;

.wrapper {
  --scale-up: 1.05;
  --scale-down: 0.95;

  display: flex;
  flex-flow: column wrap;
  max-width: var(--card-width, 40ch);
  padding: 0;
  text-align: center;

  .article {
    flex: 1;
    display: flex;
    flex-flow: column nowrap;
    justify-content: flex-start;
  }

  .cover {
    align-self: flex-start;
    place-content: center;
    height: fun.convert-px(150);
    margin: auto;
    border-bottom: fun.convert-px(1) solid var(--color-border);
  }

  .title,
  .tagline,
  .footer {
    padding: 0 var(--spacing-md);
  }

  .title {
    flex: 1;
    margin: var(--spacing-sm) 0;
  }

  h2.title {
    background: none;
    text-shadow: none;
  }

  .tagline {
    flex: 1;
    margin-bottom: var(--spacing-md);
    color: var(--color-fg);
    font-weight: 400;
  }

  .list {
    margin-bottom: var(--spacing-md);
  }

  .items {
    flex-flow: row wrap;
    place-content: center;
    gap: var(--spacing-2xs);
  }

  .term {
    flex: 0 0 100%;
  }

  .description {
    padding: fun.convert-px(2) var(--spacing-xs);
    border: fun.convert-px(1) solid var(--color-primary-darker);
    color: var(--color-fg);
    font-weight: 400;

    &::before {
      display: none;
    }
  }
}
{ asPath } = useRouter(); const webpageSchema = getWebPageSchema({ description: seo.description, locale: website.locales.default, slug: asPath, title: seo.title, updateDate: dates.update, }); const articleSchema = getSinglePageSchema({ cover: cover?.src, dates, description: intro, id: 'topic', kind: 'page', locale: website.locales.default, slug: asPath, title, }); const schemaJsonLd = getSchemaJson([webpageSchema, articleSchema]); const topicsListTitle = intl.formatMessage({ defaultMessage: 'Other topics', description: 'TopicPage: other topics list widget title', id: 'JpC3JH', }); const thematicsListTitle = intl.formatMessage({ defaultMessage: 'Related thematics', description: 'TopicPage: related thematics list widget title', id: '/sRqPT', }); const getPageHeading = () => ( <> {cover ? <NextImage {...cover} className={styles.logo} /> : null} {title} </> ); const pageUrl = `${website.url}${asPath}`; const postsListBaseUrl = `${ROUTES.TOPICS}/page/`; return ( <> <Head> <title>{seo.title}</title> {/*eslint-disable-next-line react/jsx-no-literals -- Name allowed */} <meta name="description" content={seo.description} /> <meta property="og:url" content={pageUrl} /> {/*eslint-disable-next-line react/jsx-no-literals -- Content allowed */} <meta property="og:type" content="article" /> <meta property="og:title" content={title} /> <meta property="og:description" content={intro} /> </Head> <Script // eslint-disable-next-line react/jsx-no-literals -- Id allowed id="schema-project" type="application/ld+json" // eslint-disable-next-line react/no-danger -- Necessary for schema dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} /> <PageLayout breadcrumb={breadcrumbItems} breadcrumbSchema={breadcrumbSchema} title={getPageHeading()} intro={intro} headerMeta={filteredMeta} widgets={ thematics ? [ <LinksListWidget heading={ <Heading isFake level={3}> {thematicsListTitle} </Heading> } items={getLinksListItems(thematics)} // eslint-disable-next-line react/jsx-no-literals -- Key allowed key="related-thematics" />, <LinksListWidget heading={ <Heading isFake level={3}> {topicsListTitle} </Heading> } items={getLinksListItems(topics)} // eslint-disable-next-line react/jsx-no-literals -- Key allowed key="topics" />, ] : [] } > {/*eslint-disable-next-line react/no-danger -- Necessary for content*/} {content ? <div dangerouslySetInnerHTML={{ __html: content }} /> : null} {articles ? ( <> <Heading level={2}> {intl.formatMessage( { defaultMessage: 'All posts in {topicName}', description: 'TopicPage: posts list heading', id: 'zEN3fd', }, { topicName: title } )} </Heading> <PostsList baseUrl={postsListBaseUrl} byYear={true} posts={getPostsWithUrl(articles)} titleLevel={3} total={articles.length} /> </> ) : null} </PageLayout> </> ); }; TopicPage.getLayout = (page) => getLayout(page, { useGrid: true, withExtraPadding: true }); type TopicParams = { slug: string; } & ParsedUrlQuery; export const getStaticProps: GetStaticProps<TopicPageProps> = async ({ locale, params, }) => { const currentTopic = await getTopicBySlug((params as TopicParams).slug); const totalTopics = await getTotalTopics(); const allTopicsEdges = await getTopicsPreview({ first: totalTopics, }); const allTopics = allTopicsEdges.edges.map((edge) => getPageLinkFromRawData(edge.node, 'topic') ); const topicsLinks = allTopics.filter( (topic) => topic.url !== `${ROUTES.TOPICS}/${(params as TopicParams).slug}` ); const translation = await loadTranslation(locale); return { props: { currentTopic: JSON.parse(JSON.stringify(currentTopic)), topics: JSON.parse(JSON.stringify(topicsLinks)), translation, }, }; }; export const getStaticPaths: GetStaticPaths = async () => { const slugs = await getAllTopicsSlugs(); const paths = slugs.map((slug) => { return { params: { slug } }; }); return { paths, fallback: false, }; }; export default TopicPage;