feat(portfolio): add design.aspect_ratio setting for card images#3333
Open
Vidminas wants to merge 1 commit into
Open
feat(portfolio): add design.aspect_ratio setting for card images#3333Vidminas wants to merge 1 commit into
Vidminas wants to merge 1 commit into
Conversation
Card image dimensions were hardcoded: a fixed-height box (h-48) plus a fixed 3:2 crop (Fill "600x400"). The box ratio therefore tracked card width / column count and rarely matched the crop, so object-cover re-cropped the already cropped image (a double-crop). Add a `design.aspect_ratio` knob (square | landscape | portrait | wide | photo) that mirrors the gallery block's vocabulary and drives BOTH the CSS aspect box and the Fill dimensions from one map, so the box always matches the crop β a single, predictable crop at any width / column count. Defaults to `photo` (3:2, 600x400), preserving the previous appearance, so it's non-breaking. All aspect class strings are literal in the template so Tailwind's scanner emits them. Documents the option in the block README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
β Deploy Preview for academic-demo canceled.
|
Contributor
|
Wow, your first PR! Welcome to the community! π Thank you for this contribution to open source and open research. It makes a huge impact for the thousands of innovators building with Hugo Blox. If you're wondering about next steps, please read our Contributor Guide for coding standards, how to run the project locally, and how to get help. We hope this is just the start of your journey with us. Let's build the future together! Join us on Discord to connect with the team and community. Awesome work, we'll take a look soon! β¨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Card image dimensions were hardcoded: a fixed-height box (h-48) plus a fixed 3:2 crop (Fill "600x400"). The box ratio therefore tracked card width / column count and rarely matched the crop, so object-cover re-cropped the already cropped image (a double-crop).
π What type of change is this?
π― What is the purpose of this change?
Portfolio card image dimensions are hardcoded β a fixed-height box (
h-48) plus a fixed 3:2crop (
Fill "600x400"). Two problems:design.columnsand rarely equals the crop's 3:2, soobject-coverre-crops the alreadycropped image (a double-crop).
This change adds a
design.aspect_ratioknob whose named presets mirror the galleryblock's existing
design.aspect_ratiovocabulary, plus aphoto(3:2) preset:squareaspect-squarelandscapeaspect-[4/3]portraitaspect-[3/4]wideaspect-[16/9]photo(default)aspect-[3/2]The chosen ratio drives both the CSS aspect box and the
Filldimensions from a singlemap, so the box always matches the crop β one predictable crop at any width (this is what also
resolves the double-crop). It defaults to
photo(3:2, 600Γ400), so sites that don't set itrender exactly as before β non-breaking. All aspect class strings are written literally in the
template so Tailwind's scanner generates them.
Verified on the
dev-portfoliostarter: with no config the cards renderaspect-[3/2]boxes and600Γ400 images (unchanged); with
design.aspect_ratio: widethey renderaspect-[16/9]boxesand 800Γ450 images, and Tailwind emits the
aspect-ratio: 16/9rule.πΈ Screenshots or Screencast (if applicable)
The fix β double-crop, shown at 2 columns where it's most severe:
main, fixed-heighth-48boxphoto3:2)At 2 columns the fixed-height box makes each image an ultra-wide letterbox that re-crops the 3:2
source (laptops sliced off top and bottom); the ratio box shows the full, intended 3:2 image.
The
aspect_ratiopresets (3 columns):photoβ 3:2 (default)wideβ 16:9squareβ 1:1βΉοΈ Documentation Check
This PR updates the portfolio block's
README.md: aaspect_ratiorow in the Design-parameterstable and the option in the Basic-Usage example (noting it shares the gallery block's vocabulary).
π Contributor Agreement
Thank you for your contribution!