2020-05-22 14:38:19 +02:00
|
|
|
import React, { ReactElement } from 'react'
|
2019-11-15 22:10:53 +01:00
|
|
|
import Icon from '../atoms/Icon'
|
2022-11-11 03:31:54 +01:00
|
|
|
import * as styles from './Networks.module.css'
|
2019-10-02 13:35:50 +02:00
|
|
|
|
|
|
|
function NetworkIcon({ link }: { link: string }) {
|
2019-11-15 22:10:53 +01:00
|
|
|
let IconComp
|
2019-10-02 13:35:50 +02:00
|
|
|
|
|
|
|
if (link.includes('twitter')) {
|
2019-11-15 22:10:53 +01:00
|
|
|
IconComp = <Icon name="Twitter" />
|
2019-10-02 13:35:50 +02:00
|
|
|
} else if (link.includes('github')) {
|
2019-11-15 22:10:53 +01:00
|
|
|
IconComp = <Icon name="GitHub" />
|
2019-10-02 13:35:50 +02:00
|
|
|
} else if (link.includes('feed.xml')) {
|
2019-11-15 22:10:53 +01:00
|
|
|
IconComp = <Icon name="Rss" />
|
2019-10-02 13:35:50 +02:00
|
|
|
} else if (link.includes('feed.json')) {
|
2019-11-15 22:10:53 +01:00
|
|
|
IconComp = <Icon name="Jsonfeed" />
|
2019-10-13 19:08:36 +02:00
|
|
|
} else {
|
|
|
|
return null
|
2019-10-02 13:35:50 +02:00
|
|
|
}
|
|
|
|
|
2019-11-15 22:10:53 +01:00
|
|
|
return IconComp
|
2019-10-02 13:35:50 +02:00
|
|
|
}
|
|
|
|
|
2020-05-22 14:38:19 +02:00
|
|
|
export default function IconLinks({
|
|
|
|
links
|
|
|
|
}: {
|
|
|
|
links: string[]
|
|
|
|
}): ReactElement {
|
2019-10-02 13:35:50 +02:00
|
|
|
return (
|
|
|
|
<p>
|
|
|
|
{links.map((link: string) => (
|
2022-11-11 03:31:54 +01:00
|
|
|
<a key={link} className={styles.link} href={link} title={link}>
|
2019-10-02 13:35:50 +02:00
|
|
|
<NetworkIcon link={link} />
|
|
|
|
</a>
|
|
|
|
))}
|
|
|
|
</p>
|
|
|
|
)
|
|
|
|
}
|