import { MetaKind } from '@ts/types/app';
import { TopicPreview } from '@ts/types/taxonomies';
import Link from 'next/link';
import { useIntl } from 'react-intl';
import { MetaItem } from '..';

const Topics = ({ list, kind }: { list: TopicPreview[]; kind: MetaKind }) => {
  const intl = useIntl();

  const getTopics = () => {
    return list.map((topic) => {
      return (
        <Link key={topic.databaseId} href={`/sujet/${topic.slug}`}>
          <a>{topic.title}</a>
        </Link>
      );
    });
  };

  return (
    <MetaItem
      title={intl.formatMessage(
        {
          defaultMessage:
            '{topicsCount, plural, =0 {Topics:} one {Topic:} other {Topics:}}',
          description: 'Topics: topics list meta label',
          id: '0pp/IQ',
        },
        { topicsCount: list.length }
      )}
      values={getTopics()}
      kind={kind}
    />
  );
};

export default Topics;
t type='hidden' name='id' value='daffe6e8b9e2021ffb9d006482143bc4db985f02'/><select name='h' onchange='this.form.submit();'>
<option value='main'>main</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>The frontend of my personal website.</td><td class='sub right'>Armand Philippot</td></tr></table>
<table class='tabs'><tr><td>
<a href='/www.armandphilippot.com/?h=v1.0.0'>summary</a><a href='/www.armandphilippot.com/refs/?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>refs</a><a href='/www.armandphilippot.com/log/src/components/MDX/index.tsx?h=v1.0.0'>log</a><a class='active' href='/www.armandphilippot.com/tree/src/components/MDX/index.tsx?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>tree</a><a href='/www.armandphilippot.com/commit/src/components/MDX/index.tsx?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>commit</a><a href='/www.armandphilippot.com/diff/src/components/MDX/index.tsx?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>diff</a><a href='/www.armandphilippot.com/stats/src/components/MDX/index.tsx?h=v1.0.0'>stats</a></td><td class='form'><form class='right' method='get' action='/www.armandphilippot.com/log/src/components/MDX/index.tsx'>
<input type='hidden' name='h' value='v1.0.0'/><input type='hidden' name='id' value='daffe6e8b9e2021ffb9d006482143bc4db985f02'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/www.armandphilippot.com/tree/?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>root</a>/<a href='/www.armandphilippot.com/tree/src?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>src</a>/<a href='/www.armandphilippot.com/tree/src/components?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>components</a>/<a href='/www.armandphilippot.com/tree/src/components/MDX?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>MDX</a>/<a href='/www.armandphilippot.com/tree/src/components/MDX/index.tsx?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>index.tsx</a></div><div class='content'>blob: bc7aa3508d9fed83e541c7f4ff7949e3f2858763 (<a href='/www.armandphilippot.com/plain/src/components/MDX/index.tsx?h=v1.0.0&amp;id=daffe6e8b9e2021ffb9d006482143bc4db985f02'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
</pre></td>
<td class='lines'><pre><code>