1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-06-15 17:03:26 +02: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 git clone git@github.com:kremalicious/portfolio.git
cd portfolio/ cd portfolio/
# GATSBY_GITHUB_TOKEN is required for some parts
cp .env.sample .env
vi .env
# use Docker # use Docker
docker-compose up docker-compose up

View File

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