1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +01:00

selectively import icons

This commit is contained in:
Matthias Kretschmann 2019-11-17 02:28:31 +01:00
parent b643a2128c
commit 909153e817
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 38 additions and 15 deletions

View File

@ -147,6 +147,10 @@ You can simply use [Docker](https://www.docker.com) & [Docker Compose](https://d
git clone git@github.com:kremalicious/portfolio.git
cd portfolio/
# GATSBY_GITHUB_TOKEN is required for some parts
cp .env.sample .env
vi .env
# use Docker
docker-compose up

View File

@ -2,31 +2,50 @@ import React from 'react'
import PropTypes from 'prop-types'
// https://featherstyles.com
import * as Feather from 'react-feather'
// import * as Feather from 'react-feather'
import {
ArrowDownCircle,
Edit,
GitHub,
Twitter,
Rss,
Sun,
Moon,
Compass,
FileText,
Key,
Image
} from 'react-feather'
import { ReactComponent as Dribbble } from '../../images/dribbble.svg'
import styles from './Icon.module.scss'
const Icon = ({ name, ...props }) => {
const components = {
Dribbble,
Link: Feather.Compass,
Download: Feather.ArrowDownCircle,
'Info & Download': Feather.ArrowDownCircle,
Styleguide: Feather.FileText,
Blog: Feather.Edit,
Keybase: Feather.Key
Link: Compass,
Download: ArrowDownCircle,
'Info & Download': ArrowDownCircle,
Styleguide: FileText,
Blog: Edit,
Keybase: Key,
ArrowDownCircle,
Edit,
GitHub,
Twitter,
Rss,
Sun,
Moon,
Compass,
FileText,
Key,
Image
}
const IconMapped = components[name]
const Icon = Feather[name]
// const IconComp = Feather[name]
if (!IconMapped) return null
if (!IconMapped && !Icon) return null
return IconMapped ? (
<IconMapped className={styles.icon} {...props} />
) : (
<Icon className={styles.icon} {...props} />
)
return <IconMapped className={styles.icon} {...props} />
}
Icon.propTypes = {