1
0
Fork 0
blog/src/components/atoms/Icon.tsx

57 lines
972 B
TypeScript
Raw Normal View History

2019-11-15 22:10:53 +01:00
import React from 'react'
// https://featherstyles.com
// import * as Feather from 'react-feather'
import {
ArrowDownCircle,
Edit,
GitHub,
Twitter,
Rss,
Sun,
Moon,
Compass,
X,
Clipboard,
Search,
ExternalLink,
Link,
ChevronRight,
ChevronLeft
} from 'react-feather'
2019-11-15 22:10:53 +01:00
// custom icons
import { ReactComponent as Jsonfeed } from '../../images/jsonfeed.svg'
import { ReactComponent as Bitcoin } from '../../images/bitcoin.svg'
import styles from './Icon.module.scss'
2019-11-16 16:10:34 +01:00
const components: any = {
Download: ArrowDownCircle,
2019-11-16 16:10:34 +01:00
Jsonfeed,
Bitcoin,
ArrowDownCircle,
Edit,
GitHub,
Twitter,
Rss,
Sun,
Moon,
Compass,
X,
Clipboard,
Search,
ExternalLink,
Link,
ChevronRight,
ChevronLeft
2019-11-16 16:10:34 +01:00
}
2019-11-15 22:10:53 +01:00
2019-11-16 16:10:34 +01:00
const Icon = ({ name }: { name: string }) => {
2019-11-15 22:10:53 +01:00
const IconMapped = components[name]
// const IconFeather = (Feather as any)[name]
if (!IconMapped) return null
2019-11-15 22:10:53 +01:00
return <IconMapped className={styles.icon} />
2019-11-15 22:10:53 +01:00
}
export default Icon