Skip to content
Snippets Groups Projects
Commit f6afa825 authored by Aanand Prasad's avatar Aanand Prasad Committed by Jure
Browse files

feat(ui): convert Icon to a styled component

parent 62d2c2ee
No related branches found
No related tags found
No related merge requests found
import React from 'react' import React from 'react'
import { pascalize } from 'humps' import { pascalize } from 'humps'
import * as icons from 'react-feather' import * as icons from 'react-feather'
import classes from './Icon.local.scss' import styled from 'styled-components'
const Container = styled.span`
display: inline-flex;
width: var(--icon-size);
`
const Icon = ({ children, color = 'var(--color-local, black)', size = 24 }) => { const Icon = ({ children, color = 'var(--color-local, black)', size = 24 }) => {
// convert `arrow_left` to `ArrowLeft` // convert `arrow_left` to `ArrowLeft`
...@@ -10,7 +15,7 @@ const Icon = ({ children, color = 'var(--color-local, black)', size = 24 }) => { ...@@ -10,7 +15,7 @@ const Icon = ({ children, color = 'var(--color-local, black)', size = 24 }) => {
// select the icon // select the icon
const icon = icons[name] const icon = icons[name]
return <span className={classes.root}>{icon({ color, size })}</span> return <Container>{icon({ color, size })}</Container>
} }
export default Icon export default Icon
.root {
// color of the icon is set by his parent
display: inline-flex;
width: var(--icon-size);
}
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