SVG Utility Project On React
Project Aim
This project aims to simplify the use of SVGs. in React
Description
I'll create a library that assists in managing SVGs, utilizing different interfaces to implement best practices and to support different cases.
Developer Experience
- As a developer, I want to make my development faster and easier.
- As a developer, I would like to have a documentation that guides me in building my applications with SVGs.
Problem
Often, when using Tailwind, I need to resize SVGs from external websites and convert them into components. This process is time-consuming.
Existing Solutions
- svg-to-react-cli: This package exists but lacks interfaces for various use cases, and is not updated, but still resolve manual adjustment.
Use Cases For svgestor
- Square with SVG Inside: Includes sizing interface with animation for zooming in and out.
- Moving SVG: An interface that allows for animated SVG movement.
etc.. will be more
examples in progress:
export interface clickableSvgInterface {
fill?: string;
style?: React.CSSProperties;
width?: string;
height?: string;
className?: string;
onClick?: () => void;
onMouseEnter?: () => void;
onMouseLeave?: () => void;
}
References
Adam Wathan has created a video tutorial on managing SVGs, but it still requires a lot of manual adjustments, which is time-consuming.
Objective and Idea example
svg from svgrepo
component-gmail-svg.tsx
import React from "react";
import { SvgInterface } from "../../../interfaces/svgInterface";
const ItemGmailSvg: React.FC<SvgInterface> = ({ fill, width, height, style }) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox="0 0 32 32"
style={style}
>
<path
d="M30.996 7.824v17.382a2.044 2.044 0 0 1-2.044 2.044H24.179V15.663L16 21.799l-8.179-6.136v11.588H3.049a2.044 2.044 0 0 1-2.044-2.044V7.824A3.067 3.067 0 0 1 5.92 5.376l-.008-.006L16 12.937 26.088 5.37a3.067 3.067 0 0 1 4.907 2.454z"
fill={fill}
/>
</svg>
);
};
export default ItemGmailSvg;
svginterface.tsx
/**
* interface that will define the props of the svg components
*/
export interface SvgInterface {
width?: string;
height?: string;
fill?: string;
style?: React.CSSProperties;
}
Index.tsx
<Item
fill={hoveredCard === index ? "black" : "white"}
width={hoveredCard === index ? "45" : "40"}
height={hoveredCard === index ? "45" : "40"}
style={{
transition:
"width 0.3s ease, height 0.3s ease, fill 0.3s ease",
}}

This is just a prototype of course will be more feature on the interfaces!
SVG Utility Project On React
Project Aim
This project aims to simplify the use of SVGs. in React
Description
I'll create a library that assists in managing SVGs, utilizing different interfaces to implement best practices and to support different cases.
Developer Experience
Problem
Often, when using Tailwind, I need to resize SVGs from external websites and convert them into components. This process is time-consuming.
Existing Solutions
Use Cases For svgestor
etc.. will be more
examples in progress:
References
Adam Wathan has created a video tutorial on managing SVGs, but it still requires a lot of manual adjustments, which is time-consuming.
Objective and Idea example
svg from svgrepo
component-gmail-svg.tsx
svginterface.tsx
Index.tsx
This is just a prototype of course will be more feature on the interfaces!