carinadiesel-dev / calico-creatives-react

Project initially started on https://gitlab.com/carinadiesel/calico-creatives-react
0 stars 0 forks source link

Improve SVG #34

Open carinadiesel-dev opened 1 year ago

carinadiesel-dev commented 1 year ago

In ContactForm.tsx

Feedback from Mandia :

Again my main feedback here is to try and stay clean with what you merge in

If you were to be rendering an svg straight into the JSX though, it's better to do one of 2 things:

If you need to pass props to the svg (i.e dynamic color), wrap it as a react component and use it accordingly Here's an example:


  fill,
  ...props
}: {
  fill?: string;
  [other: string]: any;
}) => {
  return (
    <svg
      {...props}
    >
      <path
 {actual svg omitted for brevity}
 You'll need backticks around the ${} but github's formatter breaks if I use them
        fill={${fill ?? "#FFF"}}
      />
    </svg>
  );
}; ```

If you don't, put it in its own file and treat it like a normal image with <img src={the svg import} />