Skip to content

Commit

Permalink
refactor: c-card--image-bottom (#297)
Browse files Browse the repository at this point in the history
* refactor: c-card--image-bottom

Do not let image-top card's `<h3>` fill available space.

Notes:
- The previous image-bottom grid-tempalte-rows value incorrectly assumed image was last row.
- Both image-top and image-bottom grid-tempalte-rows values incorrectly assumed we could reliably control image height.

* docs: card images are ready for widespread use
  • Loading branch information
wesleyboar authored Jan 10, 2024
1 parent 99a6f66 commit a091305
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/components/c-card.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-styles.cms.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-styles.docs.css

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions src/lib/_imports/components/c-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,11 @@

:--c-card--image-top,
:--c-card--image-bottom {
--image-height: auto;
--global-space--pattern-pad: 15px;

/* Repeat many times, because element count is unknown */
grid-template-rows: repeat(10, min-content);

/* Use extra columns to add horizontal padding */
grid-template-columns: var(--global-space--pattern-pad) 1fr var(--global-space--pattern-pad);
padding-inline: unset;
Expand All @@ -291,10 +293,6 @@
grid-column-end: -1;
}

:--c-card--image-top {
/* Repeat many times, because element count is unknown */
grid-template-rows: repeat(10, min-content) var(--image-height);
}
:--c-card--image-top > img {
grid-row-start: 1;
margin-bottom: var(--global-space--pattern-pad);
Expand All @@ -303,10 +301,6 @@
margin-top: unset; /* to avoid combining margin with image */
}

:--c-card--image-bottom {
/* Repeat many times, because element count is unknown */
grid-template-rows: var(--image-height) repeat(10, min-content);
}
:--c-card--image-bottom > img {
grid-row-end: -1;
margin-top: var(--global-space--pattern-pad);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_imports/components/c-card/c-card.readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Container with content and action(s) about a single subject.

---

Future features that will be added when client testing is complete:
To support images at different positions:

| Class (Std.) | Class (Alt.) | Description
| - | - | - |
Expand Down
3 changes: 1 addition & 2 deletions src/lib/_imports/components/c-card/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
status: ready
context:
shouldLoadCMS: true
📝 shouldLoadCMS: this pattern is not intended nor expected for use beyond CMS
Expand All @@ -13,9 +14,7 @@ variants:
- name: standard-3
status: backup
- name: images
status: wip
- name: docs
status: ready
context:
shouldLoadDocs: true
supportStyles:
Expand Down

0 comments on commit a091305

Please sign in to comment.