Implemented using css clip-path with an inline svg
Other information
Initially tried implementing this using a shared svg file, but the clip-path css property only works with a specific id on clipPath which made referencing the file difficult. Documentation suggests that this can be done with clip-path: url(hexagon.svg#hexPath), but I was not able to get this to work in the same way we would reference background-image: url(./hexagon.svg). I could only get this to work if the referenced svg was visible in the DOM without being conditionally rendered. Referencing svg via file path would also have to add additional webpack loaders.
I also considered appending an svg to the DOM if one is not present, but that didn't quite seem best practice.
Open to suggestions here
Describe the problem this PR addresses
Add hexagon as an image
shape
optionDescribe the changes in this PR
clip-path
with an inline svgOther information
clip-path
css property only works with a specific id onclipPath
which made referencing the file difficult. Documentation suggests that this can be done withclip-path: url(hexagon.svg#hexPath)
, but I was not able to get this to work in the same way we would referencebackground-image: url(./hexagon.svg)
. I could only get this to work if the referenced svg was visible in the DOM without being conditionally rendered. Referencing svg via file path would also have to add additional webpack loaders. I also considered appending an svg to the DOM if one is not present, but that didn't quite seem best practice. Open to suggestions here