mirror of
https://github.com/kremalicious/portfolio.git
synced 2025-02-14 21:10:41 +01:00
selectively import icons
This commit is contained in:
parent
b643a2128c
commit
909153e817
@ -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
|
||||||
|
|
||||||
|
@ -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 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user