tjikko-studio / components

Component library for Tjikko Studio apps
0 stars 0 forks source link

CTA/ Buttons refactor #108

Closed ktryndchrs closed 3 years ago

ktryndchrs commented 3 years ago

What's done:

What's left: Icons! The current way to use icon does not seems to be compatible with dynamic import of svg with custom names & paths (unless we use a library of icons, which would be heavy for no good reason… )

shawninder commented 3 years ago

What is the dist directory doing in here again?

ktryndchrs commented 3 years ago

Follow up on this comment @shawninder https://github.com/tjikko-studio/components/pull/108#discussion_r686972871

This was due to Kirby that create array of images by default.

So far my best solution on the backend side is to map every image of the content (when necessary, ex. section & logos) and change the structure of every one of them inside the content output

from this: image[{ ... }] to this: image: { ... }

My solution (to be commit soon, was based on this: and lodash (I don't have any more clever solutions at the moment) https://stackoverflow.com/questions/35055731/how-to-deeply-map-object-keys-with-javascript-lodash