react-css-styled-component-generator
v1.0.6
Published
As developers move towards CSS-in-JS solutions like styled-components, converting legacy CSS files or inline styles can be tedious and error-prone. This package would automate the process, allowing developers to migrate to styled-components more quickly a
Downloads
34
Maintainers
Readme
Styled Component Generator
A utility for converting CSS objects into styled-components automatically, allowing developers to migrate to styled-components more quickly and easily.
Installation
You can install the package via npm:
npm install react-css-styled-component-generator
yarn add react-css-styled-component-generator
Usage
Once installed, you can import and use the react-css-styled-component-generator
function in your React components:
import generateStyledComponent from "react-css-styled-component-generator";
const cssCode = {
backgroundColor: "blue",
color: "white",
padding: "10px",
borderRadius: "5px",
};
const MyStyledComponent = generateStyledComponent(cssCode, "MyStyledComponent");
// Use MyStyledComponent in your React component
const MyComponent = () => {
return <MyStyledComponent>Hello, World!</MyStyledComponent>;
};
export default MyComponent;