Last active
November 18, 2021 01:52
-
-
Save duongdam/3f2aecf5066924473d46d68161f8c224 to your computer and use it in GitHub Desktop.
Fill color and more to SVG Image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import styled from "styled-components"; | |
function SVGFillCustom({ | |
children, | |
color = '#F2685B', | |
stroke = null, | |
padding = null, | |
maxWidth = "28px", | |
maxHeight = "28px", | |
}) { | |
const StyledSVG = styled(children)` | |
fill: ${props => props.color}; | |
stroke: ${props => props.stroke}; | |
padding: ${props => props.padding}; | |
width: 100%; | |
height: 100%; | |
max-width: ${props => props.maxWidth}; | |
max-height: ${props => props.maxHeight}; | |
`; | |
return ( | |
<StyledSVG color={color} stroke={stroke} padding={padding} maxWidth={maxWidth} maxHeight={maxHeight}/> | |
) | |
} | |
export default SVGFillCustom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment