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

feat(card): promo variant #1569

Merged
merged 85 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
63c4376
fix(card): make `.empty` work
adamjohnson May 14, 2024
e873ee8
fix(card): even `#body` spacing when footer is `.empty`
adamjohnson May 14, 2024
814e034
feat(card): add inline promo demo
adamjohnson May 15, 2024
906c2ce
chore(card): add changeset for inline promo
adamjohnson May 15, 2024
3cf3939
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson May 15, 2024
387a672
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson May 16, 2024
19e525b
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson May 22, 2024
7dcf377
docs(card): rename variants demo to patterns
adamjohnson May 22, 2024
2ff0a62
fix(card): hide empty slots when there's no content
adamjohnson May 22, 2024
089d9ac
feat(card): make inline promo a WC variant
adamjohnson May 28, 2024
57e96f7
fix(card): remove inline promo comment
adamjohnson May 29, 2024
2f1a35c
fix(card): svg title text
adamjohnson May 29, 2024
f603b8e
docs(card): update changeset
adamjohnson May 29, 2024
4331e06
docs(card): change `patterns.html` back to `variants.html`
adamjohnson May 29, 2024
ab48223
fix(card): move inline-promo margin to demo styles
adamjohnson Jun 4, 2024
ad21ced
fix(card): remove inline promo full width padding
adamjohnson Jun 4, 2024
75da1c7
fix(card): rename slot `inline-promo` to `image`
adamjohnson Jun 4, 2024
837b09c
fix(card): remove `one-col` and `reverse` attrs
adamjohnson Jun 6, 2024
0309f97
fix(card): remove `full-width` attr, convert to class + `part` selector
adamjohnson Jun 7, 2024
decbb9b
fix(card): move `standard` styles to demo
adamjohnson Jun 7, 2024
7c3b1f2
docs(card): change attr docs to reference `class`
adamjohnson Jun 7, 2024
ceb57c3
docs(card): inline promo inline docs layout tweaks
adamjohnson Jun 7, 2024
f942a05
fix(card): update inline promo CSS attr selector
adamjohnson Jun 7, 2024
0131c42
fix(card): nix outdated `full-width` prop and var docs
adamjohnson Jun 7, 2024
cef0ff3
docs(card): update changeset
adamjohnson Jun 14, 2024
325c8e0
fix(card): style header when image is present
bennypowers Jun 5, 2024
74540b8
docs(card): implement asset and image patterns
bennypowers Jun 5, 2024
0ad4f98
docs(card): logo pattern
bennypowers Jun 6, 2024
359d61f
docs(card): quote pattern
bennypowers Jun 6, 2024
bb3b7ad
docs(card): image pattern
bennypowers Jun 6, 2024
f8a6fe6
docs(card): icon pattern
bennypowers Jun 6, 2024
d7f067a
docs(card): asset pattern
bennypowers Jun 6, 2024
da98ff7
docs: remove unused images
bennypowers Jun 6, 2024
8d33003
docs: rename inline promo pattern file
bennypowers Jun 6, 2024
018d658
docs(card): sticky pattern
bennypowers Jun 6, 2024
4d5a372
docs(card): title pattern
bennypowers Jun 6, 2024
afb2589
docs(card): video pattern
bennypowers Jun 6, 2024
4635bbc
fix(card): merge updates from base
bennypowers Jun 13, 2024
4ec043d
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
bennypowers Jun 16, 2024
577857e
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
bennypowers Jun 16, 2024
9f649a7
docs(card): pattern fixes
bennypowers Jun 16, 2024
a5855d4
fix(card): has-body shadow class, header margin
bennypowers Jun 17, 2024
7cd974a
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson Jun 18, 2024
8a24c97
fix(card): remove `isServer`, it's not in use
adamjohnson Jun 20, 2024
7e5f6ed
fix(card): inline promo heading and paragraph spacing
adamjohnson Jun 20, 2024
11facbd
fix(card): inline promo tweaks
bennypowers Jun 24, 2024
7ad749f
fix(card): promo tweaks
bennypowers Jun 24, 2024
93d9a09
fix(card): promo tweaks
bennypowers Jun 24, 2024
d307505
refactor(card): class names
bennypowers Jun 24, 2024
fe7549f
fix(card): private vars
bennypowers Jun 24, 2024
2975038
fix(card): remove unused private var
bennypowers Jun 24, 2024
410b4a2
docs(card): inline-promo
bennypowers Jun 24, 2024
16ce8ca
fix(card): rename inline promo to promo
bennypowers Jun 24, 2024
c1c2a13
fix(card): imageless promo layout
bennypowers Jun 24, 2024
1aed49d
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
bennypowers Jun 24, 2024
18da2b3
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
zeroedin Jun 25, 2024
2d3cf8c
docs(card): align image when reversed
bennypowers Jun 30, 2024
e30d737
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
bennypowers Jun 30, 2024
7d10572
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson Jul 11, 2024
67a3643
fix(card): remove 1px spacing around promo image
adamjohnson Jul 12, 2024
7d03104
fix(card): unify promo demo sample SVG attr values
adamjohnson Jul 12, 2024
50391d4
refactor(card): alphabetize promo container css
adamjohnson Jul 12, 2024
33eb9eb
fix(card): touch up promo spacing
adamjohnson Jul 12, 2024
9953acd
fix(card): add appropriate promo standard typography
adamjohnson Jul 12, 2024
4441bb3
fix(card): increase promo standard desktop padding
adamjohnson Jul 12, 2024
49e7fb1
fix(card): fix spacing with standard promo
adamjohnson Jul 12, 2024
ccce836
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson Jul 12, 2024
ff895e2
fix(card): promo layouts
bennypowers Jul 14, 2024
2bc8483
docs(card): promo demos
bennypowers Jul 14, 2024
6ff63e9
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson Jul 18, 2024
daba725
fix(card): improve standard promo spacing
adamjohnson Jul 18, 2024
11812d4
docs(card): add promo standard demo gutters
adamjohnson Jul 18, 2024
12c8dac
fix(card): role `img`
adamjohnson Jul 23, 2024
431d819
feat(card): add `full-width` attribute to promo
adamjohnson Jul 23, 2024
78d2cb1
docs(card): layout tweaks for promo demo
adamjohnson Jul 23, 2024
eaf7f4c
docs(card): change one promo narrow card
adamjohnson Jul 23, 2024
c607e4d
feat(card): make public vars work with promo variant
adamjohnson Jul 23, 2024
e8fb10b
docs(card): improve wording around promo changes
adamjohnson Jul 23, 2024
2e41872
fix(card): match promo border mockup to code
adamjohnson Jul 26, 2024
34ea428
fix(card): update promo standard bkg color
adamjohnson Jul 26, 2024
bbf4523
docs(card): add dark examples to promo + full width demos
adamjohnson Jul 26, 2024
646036a
fix(card): style `.reverse` on container grid, not image/body
adamjohnson Jul 26, 2024
5de06b0
fix(card): increase promo image width
adamjohnson Jul 26, 2024
3562561
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson Jul 30, 2024
a3c6f81
Merge branch 'staging/charmander' into feat/card/inline-promo-variant
adamjohnson Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changeset/fair-buttons-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@rhds/elements": minor
---

`<rh-card>`: ✨ Added Inline Promo variant
bennypowers marked this conversation as resolved.
Show resolved Hide resolved

The Inline Promo card variant allows users to easily display text and optionally an image side by side.

```html
<rh-card variant="inline-promo">
<svg slot="image" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 190">
<title>A placeholder image in rh-card in the "image" slot</title>
<rect x="0" y="0" width="320" height="190" fill="#e7f0f9"/>
<line x1="0" y1="0" x2="320" y2="190" stroke="#d6e7f5"/>
<line x1="320" y1="0" x2="0" y2="190" stroke="#d6e7f5"/>
</svg>

<h2>Featured: left aligned with image</h2>
<p>This is the default Inline Promo card. If you want, you can customize the shadow DOM by using the <code>::part</code> selector. Using this technique, you can have padding on any side, or none at all.</p>
<rh-cta>
<a href="#">Call to action</a>
</rh-cta>
</rh-card>
```
108 changes: 108 additions & 0 deletions elements/rh-card/demo/asset-pattern.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<section id="card-pattern-asset">
<rh-card>
<svg class="sample" slot="image" width="296" height="171"><rect/></svg>
<pf-icon icon="info-circle"
size="md"
slot="header"></pf-icon>
<h2 slot="header">Title, lg</h2>
<a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
</rh-card>

<rh-card>
<svg class="sample" slot="image" width="296" height="171"><rect/></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card class="footer-asset">
<h2 slot="header">Title, lg</h2>
<a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
<svg class="sample" slot="footer" width="296" height="171"><rect/></svg>
</rh-card>

<rh-card color-palette="lighter">
<svg class="sample" slot="image" width="296" height="171"><rect/></svg>
<pf-icon icon="info-circle"
size="md"
slot="header"></pf-icon>
<h2 slot="header">Title, lg</h2>
<a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
</rh-card>

<rh-card color-palette="lighter">
<svg class="sample" slot="image" width="296" height="171"><rect/></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="lighter" class="footer-asset">
<h2 slot="header">Title, lg</h2>
<a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
<svg class="sample" slot="footer" width="296" height="171"><rect/></svg>
</rh-card>
</section>

<style>
svg.sample {
border: 1px dashed var(--rh-color-border-interactive-on-light, #0066cc);
& rect { width: 100%; height: 100%; fill: rgba(0 102 204 / 0.10) }
}
#card-pattern-asset {
display: grid;
gap: var(--rh-space-md, 16px);
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
& rh-card {
height: 100%;
& h2 { flex: 1 1 auto; }
& img { width: 100%; }
&::part(container) { height: 100%; }
&::part(header) {
display: flex;
align-items: center;
flex-flow: row;
font-family: var(--rh-font-family-body-text, RedHatText, "Red Hat Text", "Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans JP", "Noto Sans KR", "Noto Sans Malayalam", "Noto Sans SC", "Noto Sans TC", "Noto Sans Thai", Helvetica, Arial, sans-serif);
font-size: var(--rh-font-size-body-text-md, 1rem);
font-weight: var(--rh-font-weight-heading-regular, 400);
text-transform: uppercase;
}
&::part(image) {
padding: var(--rh-space-2xl, 32px);
padding-block-end: 0;
background-color: var(--rh-color-surface-lighter, #f2f2f2);
}
&::part(body) {
margin-block-start: 0;
padding-block-start: var(--rh-space-lg, 16px);
}
&.footer-asset::part(footer) {
margin: 0;
margin-block-start: auto;
padding: var(--rh-space-2xl, 32px);
padding-block-end: 0;
background-color: var(--rh-color-surface-lighter, #f2f2f2);
}
&[color-palette="lighter"] {
&::part(image) {
background-color: var(--rh-color-surface-light, #e0e0e0);
}
&.footer-asset::part(footer) {
background-color: var(--rh-color-surface-light, #e0e0e0);
}
}
}
}
</style>

<script type="module">
import '@patternfly/elements/pf-icon/pf-icon.js';
import '@rhds/elements/rh-card/rh-card.js';
import '@rhds/elements/rh-cta/rh-cta.js';
</script>
Binary file removed elements/rh-card/demo/bg-pattern.png
Binary file not shown.
121 changes: 121 additions & 0 deletions elements/rh-card/demo/icon-pattern.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<section id="card-pattern-icon">
<rh-card>
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card>
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="lighter">
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="lighter">
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="dark">
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="dark">
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="darker">
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="darker">
<svg class="sample" slot="header" width="80" height="80" ><rect/></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>
</section>

<style>
svg.sample {
border: 1px dashed var(--rh-color-border-interactive-on-light, #0066cc);
& rect { width: 100%; height: 100%; fill: rgba(0 102 204 / 0.10) }
}
#card-pattern-icon {
display: grid;
gap: var(--rh-space-md, 16px);
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
& rh-card {
height: 100%;
&::part(container) {
height: 100%;
}
&::part(header) {
flex-flow: column;
gap: var(--rh-space-2xl, 32px);
}
&::part(body) {
margin-block-start: var(--rh-space-lg, 16px);
}
& > p {
margin-block: 0;
}
& h2 {
font-size: var(--rh-font-size-code-2xl, 1.5rem);
}
}
}
</style>

<script type="module">
import '@rhds/elements/rh-card/rh-card.js';
import '@rhds/elements/rh-cta/rh-cta.js';
</script>
110 changes: 110 additions & 0 deletions elements/rh-card/demo/image-pattern.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<section id="card-pattern-image">
<rh-card>
<svg class="sample" slot="image"><rect></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card>
<svg class="sample" slot="image"><rect></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="lighter">
<svg class="sample" slot="image"><rect></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="lighter">
<svg class="sample" slot="image"><rect/></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="dark">
<svg class="sample" slot="image"><rect></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="dark">
<svg class="sample" slot="image"><rect></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="darker">
<svg class="sample" slot="image"><rect></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>

<rh-card color-palette="darker">
<svg class="sample" slot="image"><rect></svg>
<h2 slot="header">Heading, sm</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit
libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id
elit. Donec id elit non mi porta gravida at eget metus.</p>
<rh-cta slot="footer">
<a href="#">Call to action</a>
</rh-cta>
</rh-card>
</section>

<style>
svg.sample {
border: 1px dashed var(--rh-color-border-interactive-on-light, #0066cc);
width: 100%;
aspect-ratio: 296/171;
& rect { width: 100%; height: 100%; fill: rgba(0 102 204 / 0.10) }
}
#card-pattern-image {
display: grid;
gap: var(--rh-space-md, 16px);
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
& rh-card {
height: 100%;
&::part(container) {
height: 100%;
}
}
}
</style>

<script type="module">
import '@rhds/elements/rh-card/rh-card.js';
import '@rhds/elements/rh-cta/rh-cta.js';
</script>
Loading
Loading