Skip to content
Snippets Groups Projects
Commit 498c30cf authored by Sinzeanu Demetriad's avatar Sinzeanu Demetriad
Browse files

feat(My-Icons): Use Custom Icons

parent 6109bf28
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!190Hin 1141
...@@ -29,7 +29,7 @@ const PersonInvitation = ({ ...@@ -29,7 +29,7 @@ const PersonInvitation = ({
> >
{showModal => ( {showModal => (
<IconButton <IconButton
icon="refresh-cw" icon="resend"
iconSize={2} iconSize={2}
ml={2} ml={2}
onClick={showModal} onClick={showModal}
......
import React from 'react'
import { withTheme } from 'styled-components'
import { get, has } from 'lodash'
import * as reactFeatherIcons from 'react-feather'
const Icon = ({ iconName, overrideName, className, theme, ...props }) => {
const isOverrideInTheme = has(theme.icons, overrideName)
if (isOverrideInTheme) {
const OverrideIcon = get(theme.icons, overrideName)
return <OverrideIcon className={className} {...props} />
}
const isIconInDefaultSet = reactFeatherIcons[iconName]
// TODO: conversation with Pubsweet - what should we default to when
// there's no obvious react-feather equivalent?
if (!isIconInDefaultSet) {
// eslint-disable-next-line no-console
console.warn("Icon '%s' not found", iconName)
return null
}
const DefaultIcon = reactFeatherIcons[iconName]
return <DefaultIcon className={className} {...props} />
}
export default withTheme(Icon)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment