Skip to content

Instantly share code, notes, and snippets.

@duongdam
Last active November 18, 2021 01:52
Show Gist options
  • Save duongdam/3f2aecf5066924473d46d68161f8c224 to your computer and use it in GitHub Desktop.
Save duongdam/3f2aecf5066924473d46d68161f8c224 to your computer and use it in GitHub Desktop.
Fill color and more to SVG Image
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