kirby icon indicating copy to clipboard operation
kirby copied to clipboard

Image blocks: add pattern background

Open distantnative opened this issue 1 year ago • 9 comments

This PR …

Enhancements

  • Image/Gallery blocks: added back option to specify an image background, e.g. to be able to see white graphics with transparent backgrounds

Docs

fields:
  blocks:
    type: blocks
    fieldsets:
      - type: image
        back: pattern-light

For review team

  • [ ] Add changes & docs to release notes draft in Notion

distantnative avatar May 01 '24 12:05 distantnative

Maybe it'd be possible to toggle this via a blueprint option? I think it's a good thing, especially with the dark mode coming up, but most of my blocks don't need it as you figured.

tobimori avatar May 02 '24 12:05 tobimori

I also think that this could/should be a toggle. Maybe to even toggle between white/black/pattern.

bastianallgeier avatar May 06 '24 08:05 bastianallgeier

@bastianallgeier like an actual toggle field? The issue right now is that I wanted to rather add it as a fieldset blueprint option. However, I realized that fieldsets do no allow passing any custom options: https://github.com/getkirby/kirby/blob/main/src/Cms/Fieldset.php#L204-L219

distantnative avatar May 11 '24 13:05 distantnative

@distantnative I was thinking of a toggle in the block preview component. I would not connect it to the blueprint

bastianallgeier avatar May 12 '24 09:05 bastianallgeier

@bastianallgeier but if it's not a fixed state, one would have to change the toggle e.g. for a white transparent graphic to pattern each time loading the view. Or would we try to store that in localStorage?

distantnative avatar May 12 '24 09:05 distantnative

Do you think it's going to get too messy to put it in localStorage? I think that would be quite nice as a solution.

bastianallgeier avatar May 12 '24 09:05 bastianallgeier

I think the localStorage part could work. Just thinking of the UI of this toggle, won't be so easy as it would have to float on top of the image, or what do you have in mind?

https://github.com/getkirby/kirby/assets/3788865/a027bded-950c-4001-a44c-8a5745b9f9f6

distantnative avatar May 12 '24 10:05 distantnative

I think it really looks good already. I wonder if we should use the background on the entire width or really only for the image. We could maybe reuse https://lab.getkirby.com/public/lab/components/frames/4_color to create a little square button in the bottom right corner instead of the text button. Maybe together with a dropdown arrow.

bastianallgeier avatar May 17 '24 14:05 bastianallgeier

I would go with the entire width. Looks better.

tobimori avatar May 17 '24 14:05 tobimori

@bastianallgeier Implemented a visual selector as suggested.

Also coloring now the full block which I think looks best.

distantnative avatar Jul 25 '24 13:07 distantnative

I've pushed a suggestion for a slight design change for the button …

Screenshot 2024-07-25 at 16 23 40

bastianallgeier avatar Jul 25 '24 14:07 bastianallgeier