Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image blocks: add pattern background #6430

Merged
merged 9 commits into from
Jul 25, 2024

Conversation

distantnative
Copy link
Member

@distantnative distantnative commented May 1, 2024

Description

Summary of changes

  • Image and gallery block now feature a little background color selector dropdown (selection gets stored in localStorage)
  • k-block-figure: New back option to set the background (pass pure CSS value)
  • New k-block-figure-caption that adapts its color based on the background (to also work on dark backgrounds)
  • New k-block-background-dropdown
  • k-color-frame can now also handle patterns as pseudo-color

Changelog

Enhancements

  • Image/Gallery blocks: added selector to change background
Screen.Recording.2024-07-25.at.15.33.03.mov

For review team

  • Add changes & docs to release notes draft in Notion

@distantnative distantnative added type: enhancement ✨ Suggests an enhancement; improves Kirby needs: decision 🗳 Requires a decision to proceed labels May 1, 2024
@distantnative distantnative added this to the 4.3.0 milestone May 1, 2024
@distantnative distantnative self-assigned this May 1, 2024
@tobimori
Copy link
Contributor

tobimori commented May 2, 2024

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.

@bastianallgeier
Copy link
Member

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

@distantnative distantnative added needs: changes 🔁 Implement any requested changes to proceed and removed needs: decision 🗳 Requires a decision to proceed labels May 11, 2024
@distantnative distantnative marked this pull request as draft May 11, 2024 11:21
@distantnative distantnative force-pushed the fix/6378-blocks-img-pattern branch from 46f8eb1 to b976d8c Compare May 11, 2024 13:18
@distantnative
Copy link
Member Author

@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 distantnative force-pushed the fix/6378-blocks-img-pattern branch from b976d8c to 8a80bc6 Compare May 11, 2024 13:25
@distantnative distantnative removed this from the 4.3.0 milestone May 11, 2024
@bastianallgeier
Copy link
Member

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

@distantnative
Copy link
Member Author

@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?

@bastianallgeier
Copy link
Member

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.

@distantnative
Copy link
Member Author

distantnative commented May 12, 2024

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?

Screen.Recording.2024-05-12.at.12.43.38.mov

@bastianallgeier
Copy link
Member

bastianallgeier commented May 17, 2024

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.

@tobimori
Copy link
Contributor

I would go with the entire width. Looks better.

@github-actions github-actions bot added the type: stale 💤 Will be closed soon because there was no recent activity label Jul 17, 2024
@getkirby getkirby deleted a comment from github-actions bot Jul 17, 2024
@distantnative distantnative removed the type: stale 💤 Will be closed soon because there was no recent activity label Jul 17, 2024
@distantnative distantnative force-pushed the fix/6378-blocks-img-pattern branch from 8a80bc6 to 8faff8f Compare July 25, 2024 13:30
@distantnative distantnative force-pushed the fix/6378-blocks-img-pattern branch from 8faff8f to 6a94f92 Compare July 25, 2024 13:42
@distantnative distantnative removed the needs: changes 🔁 Implement any requested changes to proceed label Jul 25, 2024
@distantnative distantnative marked this pull request as ready for review July 25, 2024 13:43
@distantnative
Copy link
Member Author

@bastianallgeier Implemented a visual selector as suggested.

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

@distantnative distantnative requested a review from a team July 25, 2024 13:44
@distantnative distantnative added this to the 4.4.0 milestone Jul 25, 2024
@distantnative distantnative linked an issue Jul 25, 2024 that may be closed by this pull request
@bastianallgeier
Copy link
Member

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

Screenshot 2024-07-25 at 16 23 40

@bastianallgeier bastianallgeier self-requested a review July 25, 2024 14:48
Copy link
Member

@bastianallgeier bastianallgeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ready to go in my opinion.

@distantnative distantnative merged commit d3d8a70 into develop-minor Jul 25, 2024
16 checks passed
@distantnative distantnative deleted the fix/6378-blocks-img-pattern branch July 25, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

White PNG/SVG images are not visible in the panel
3 participants