1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00
blog/src/components/molecules/IconLinks.tsx
2019-11-16 14:06:03 +01:00

34 lines
808 B
TypeScript

import React from 'react'
import styles from './IconLinks.module.scss'
import Icon from '../atoms/Icon'
function NetworkIcon({ link }: { link: string }) {
let IconComp
if (link.includes('twitter')) {
IconComp = <Icon name="Twitter" />
} else if (link.includes('github')) {
IconComp = <Icon name="GitHub" />
} else if (link.includes('feed.xml')) {
IconComp = <Icon name="Rss" />
} else if (link.includes('feed.json')) {
IconComp = <Icon name="Jsonfeed" />
} else {
return null
}
return IconComp
}
export default function IconLinks({ links }: { links: string[] }) {
return (
<p>
{links.map((link: string) => (
<a key={link} className={styles.link} href={link} title={link}>
<NetworkIcon link={link} />
</a>
))}
</p>
)
}