Log1x / acf-composer

Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.
https://github.com/Log1x/acf-composer
MIT License
413 stars 56 forks source link

enhance: add text and background color support #145

Closed aon21 closed 1 year ago

Log1x commented 1 year ago

The latest changes on this look good! I'll try to test it sometime this week. :)

felipefanucchi commented 1 year ago

Any expectations of when this will get merged? 👀

Log1x commented 1 year ago

I'm a little confused by the output of the inlineStyle stuff to get spacing/etc. If I dump $block->style I seem to get:

+"style": array:1 [â–¼
  "spacing" => array:1 [â–¼
    "padding" => array:4 [â–¼
      "top" => "var:preset|spacing|70"
      "right" => "var:preset|spacing|70"
      "bottom" => "var:preset|spacing|70"
      "left" => "var:preset|spacing|70"
    ]
  ]
]

where each value is var:preset|spacing|xx which wouldn't be valid when inlined in the style tag of the block.

I think it was generally supposed to output the actual CSS var like var(--preset-spacing-70) I think?

Did something change between the initial PR and now? Am I missing something? Do we need to deserialize this ourselves? 😩

aon21 commented 1 year ago

Actually there was more issues to it. Added a css formatter as a helper to build css correctly. Didn't want to put it in the same file as its already very big. Updated gradients to be returned in classes and in inline style. As there are two ways how wp adds gradients:

  1. When selecting in Collor picker, wp adds css as inline style.
  2. When using gradient presets, wp adds it as class.

Updated stubs too.

Log1x commented 1 year ago

Nice! I will get to this when I wake up. Was waiting on this before I push a release.

I think we could probably move the CssFormatter into a Trait inside of the Concerns directory and name it something like FormatsStyles or FormatsCss.

Also need to add color stuff to the construct block stub.

aon21 commented 1 year ago

Thats a good idea. Moved it into a Trait.