Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG attrubutes return lowercase. I want to svg attributes return camelcase.. #103

Open
kakonbarman opened this issue Feb 12, 2023 · 0 comments

Comments

@kakonbarman
Copy link

`import ReactHtmlParser from "react-html-parser";

export const JltIconText = ({ attributes }) => {
const { text, iconSvg } = attributes;

console.log("iconSvg", iconSvg);
// result: iconSvg <svg width="24" height="23" viewBox="0 0 24 23" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.3478 1.45654H1V21.5435H21.087V14.8478" stroke="#EB5E81" strokeWidth="1.875" strokeLinecap="round" strokeLinejoin="round"/><path d="M6.73901 11.0217L11.5216 15.8044L22.9999 3.36957" stroke="#EB5E81" strokeWidth="1.875" strokeLinecap="round" strokeLinejoin="round"/></svg>

//ReactHtmlParser(iconSvg)
// result <svg width="24" height="23" viewbox="0 0 24 23" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.3478 1.45654H1V21.5435H21.087V14.8478" stroke="#EB5E81" strokewidth="1.875" strokelinecap="round" strokelinejoin="round"></path><path d="M6.73901 11.0217L11.5216 15.8044L22.9999 3.36957" stroke="#EB5E81" strokewidth="1.875" strokelinecap="round" strokelinejoin="round"></path></svg>

// compare this
// strokeLinecap="round" not equal to strokelinecap="round"

return (
    <div className="jlt-flex jlt-items-center">
        <span className="jlt_svg__icon">{ReactHtmlParser(iconSvg)}</span>
        <span className="jlt-ml-2">{text}</span>
    </div>
);

};
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant