summaryrefslogtreecommitdiffstats
path: root/src/components/PostFooter/PostFooter.tsx
blob: fe933d723ffdab1860ac5050088cc7399f35d708 (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
import { t } from '@lingui/macro';
import { SubjectPreview } from '@ts/types/taxonomies';
import Image from 'next/image';
import Link from 'next/link';
import styles from './PostFooter.module.scss';

const PostFooter = ({ subjects }: { subjects: SubjectPreview[] }) => {
  const getSubjects = () => {
    return subjects.map((subject) => {
      return (
        <li className={styles.item} key={subject.id}>
          <Link href={`/sujet/${subject.slug}`}>
            <a className={styles.link}>
              {subject.featuredImage && (
                <Image
                  src={subject.featuredImage.sourceUrl}
                  alt={subject.featuredImage.altText}
                  layout="intrinsic"
                  width="20"
                  height="20"
                />
              )}
              {subject.title}
            </a>
          </Link>
        </li>
      );
    });
  };

  return (
    <footer>
      {subjects.length > 0 && (
        <>
          <dl className={styles.meta}>
            <dt>{t`Read more articles about:`}</dt>
            <dd>
              <ul className={styles.list}>{getSubjects()}</ul>
            </dd>
          </dl>
        </>
      )}
    </footer>
  );
};

export default PostFooter;
- Storybook Meta */ export default { title: 'Molecules/Forms/Toggle', component: MotionToggleComponent, argTypes: { bodyClassName: { control: { type: 'text', }, description: 'Set additional classnames to the fieldset body wrapper.', table: { category: 'Styles', }, type: { name: 'string', required: false, }, }, defaultValue: { control: { type: 'select', }, description: 'Set the default value.', options: ['on', 'off'], type: { name: 'string', required: true, }, }, groupClassName: { control: { type: 'text', }, description: 'Set additional classnames to the radio group wrapper.', table: { category: 'Styles', }, type: { name: 'string', required: false, }, }, legendClassName: { control: { type: 'text', }, description: 'Set additional classnames to the legend.', table: { category: 'Styles', }, type: { name: 'string', required: false, }, }, storageKey: { control: { type: 'text', }, description: 'Set local storage key.', type: { name: 'string', required: true, }, }, }, } as ComponentMeta<typeof MotionToggleComponent>; const Template: ComponentStory<typeof MotionToggleComponent> = (args) => ( <MotionToggleComponent {...args} /> ); /** * Toggle Stories - Motion */ export const Motion = Template.bind({}); Motion.args = { defaultValue: 'on', storageKey, };