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

docs(card): demo of cards in flex container #2087

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
105 changes: 105 additions & 0 deletions elements/rh-card/demo/in-flex-container.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<div class="flex">
<rh-card>
<svg slot="header" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 522 191.4">
<defs>
<clipPath id="clippath">
<path fill="none" d="M0 0h522v191.4H0z"/>
</clipPath>
</defs>
<g clip-path="url(#clippath)">
<path fill="#f2f2f2" d="M0 0h522v192H0z"/>
<path stroke="#e0e0e0" fill="#fff" d="M91.58 36.98c-3.97 0-7.8.6-11.4 1.71-8.67-16.31-25.83-27.42-45.6-27.42-21.98 0-40.74 13.75-48.18 33.11-14.05.47-26.01 9.19-31.17 21.48-1.96-.5-4.02-.77-6.15-.77-13.65 0-24.71 11.06-24.71 24.71s11.06 24.71 24.71 24.71h142.5c21.41 0 38.76-17.35 38.76-38.76s-17.35-38.76-38.76-38.76Z"/>
<path fill="none" stroke-miterlimit="10" stroke="#e00" stroke-width="2" d="M199.89 39.05s-71.29.75-116.93 20.8c-40.09 17.62-57.7 44.65-35.23 84.73 22.47 40.09 94.76 11.66 154.89-21.87"/>
<circle fill="#e00" cx="45.66" cy="140.72" r="6.64"/>
<path fill="none" stroke-miterlimit="10" stroke="#e00" stroke-width="2" d="M474.13 59.86s-16.4-43.08-75.32-30.5c-58.92 12.58-93.53 29.34-93.53 29.34"/>
<circle fill="#e00" cx="401.67" cy="29.29" r="6.64"/>
<rect fill="#c7c7c7" x="176.13" y="54.57" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#c7c7c7" x="176.13" y="90.59" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#c7c7c7" x="176.13" y="126.62" width="103.41" height="30.98" rx="3" ry="3"/>
<path fill="#c7c7c7" d="M183.36 18.43h162.79V179.4H183.36z"/>
<path fill="#e0e0e0" d="M181.97 33.43h162.79V178H181.97z"/>
<path fill="#fff" d="M182.47 17.53h161.79v16.01H182.47z"/>
<path fill="#e0e0e0" d="M343.76 18.03v15.01H182.97V18.03h160.79m1-1H181.97v17.01h162.79V17.03Z"/>
<path fill="#fff" d="M190.47 39.05h101.59v132.57H190.47zM297.53 39.05h42.37v47.16h-42.37zM297.53 92.81h42.37v78.81h-42.37z"/>
<circle fill="#e00" cx="305.12" cy="25.72" r="3.64"/>
<circle fill="#e00" cx="319.55" cy="25.72" r="3.64"/>
<circle fill="#e00" cx="333.21" cy="25.72" r="3.64"/>
<rect fill="#fce3e3" x="175.44" y="53.18" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#e00" x="185" y="59.86" width="5.16" height="17.62" rx="2" ry="2"/>
<rect fill="#e00" x="194.72" y="59.86" width="5.16" height="17.62" rx="2" ry="2"/>
<circle fill="#e00" cx="261.54" cy="62.63" r="2.73"/>
<circle fill="#e00" cx="269.17" cy="62.63" r="2.73"/>
<rect fill="#fce3e3" x="175.44" y="89.2" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#e00" x="185" y="95.88" width="5.16" height="17.62" rx="2" ry="2"/>
<rect fill="#e00" x="194.72" y="95.88" width="5.16" height="17.62" rx="2" ry="2"/>
<circle fill="#e00" cx="261.54" cy="98.66" r="2.73"/>
<circle fill="#e00" cx="269.17" cy="98.66" r="2.73"/>
<rect fill="#fce3e3" x="175.44" y="125.23" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#e00" x="185" y="131.91" width="5.16" height="17.62" rx="2" ry="2"/>
<rect fill="#e00" x="194.72" y="131.91" width="5.16" height="17.62" rx="2" ry="2"/>
<circle fill="#e00" cx="261.54" cy="134.69" r="2.73"/>
<circle fill="#e00" cx="269.17" cy="134.69" r="2.73"/>
<path stroke="#e0e0e0" fill="#fff" d="M515.7 74.04c-4.48 0-8.81.68-12.88 1.93-9.8-18.42-29.18-30.97-51.5-30.97-24.83 0-46.02 15.53-54.42 37.4-15.87.53-29.38 10.38-35.2 24.26a27.9 27.9 0 0 0-6.94-.87c-15.41 0-27.91 12.49-27.91 27.91 0 15.41 12.5 27.91 27.91 27.91h160.95c24.18 0 43.78-19.6 43.78-43.78s-19.6-43.78-43.78-43.78Z"/>
</g>
</svg>
<h3 slot="header">Migrate virtual machines with minimal disruption</h3>
<p>Moving your VMs to a unified platform will help you reliably and flexibly deploy applications across the hybrid cloud.</p>
<rh-cta slot="footer" href="#">Call to action</rh-cta>
</rh-card>

<rh-card>
<svg slot="header" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 522 191.4">
<g clip-path="url(#clippath)">
<path fill="#f2f2f2" d="M0 0h522v192H0z"/>
<path stroke="#e0e0e0" fill="#fff" d="M91.58 36.98c-3.97 0-7.8.6-11.4 1.71-8.67-16.31-25.83-27.42-45.6-27.42-21.98 0-40.74 13.75-48.18 33.11-14.05.47-26.01 9.19-31.17 21.48-1.96-.5-4.02-.77-6.15-.77-13.65 0-24.71 11.06-24.71 24.71s11.06 24.71 24.71 24.71h142.5c21.41 0 38.76-17.35 38.76-38.76s-17.35-38.76-38.76-38.76Z"/>
<path fill="none" stroke-miterlimit="10" stroke="#e00" stroke-width="2" d="M199.89 39.05s-71.29.75-116.93 20.8c-40.09 17.62-57.7 44.65-35.23 84.73 22.47 40.09 94.76 11.66 154.89-21.87"/>
<circle fill="#e00" cx="45.66" cy="140.72" r="6.64"/>
<path fill="none" stroke-miterlimit="10" stroke="#e00" stroke-width="2" d="M474.13 59.86s-16.4-43.08-75.32-30.5c-58.92 12.58-93.53 29.34-93.53 29.34"/>
<circle fill="#e00" cx="401.67" cy="29.29" r="6.64"/>
<rect fill="#c7c7c7" x="176.13" y="54.57" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#c7c7c7" x="176.13" y="90.59" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#c7c7c7" x="176.13" y="126.62" width="103.41" height="30.98" rx="3" ry="3"/>
<path fill="#c7c7c7" d="M183.36 18.43h162.79V179.4H183.36z"/>
<path fill="#e0e0e0" d="M181.97 33.43h162.79V178H181.97z"/>
<path fill="#fff" d="M182.47 17.53h161.79v16.01H182.47z"/>
<path fill="#e0e0e0" d="M343.76 18.03v15.01H182.97V18.03h160.79m1-1H181.97v17.01h162.79V17.03Z"/>
<path fill="#fff" d="M190.47 39.05h101.59v132.57H190.47zM297.53 39.05h42.37v47.16h-42.37zM297.53 92.81h42.37v78.81h-42.37z"/>
<circle fill="#e00" cx="305.12" cy="25.72" r="3.64"/>
<circle fill="#e00" cx="319.55" cy="25.72" r="3.64"/>
<circle fill="#e00" cx="333.21" cy="25.72" r="3.64"/>
<rect fill="#fce3e3" x="175.44" y="53.18" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#e00" x="185" y="59.86" width="5.16" height="17.62" rx="2" ry="2"/>
<rect fill="#e00" x="194.72" y="59.86" width="5.16" height="17.62" rx="2" ry="2"/>
<circle fill="#e00" cx="261.54" cy="62.63" r="2.73"/>
<circle fill="#e00" cx="269.17" cy="62.63" r="2.73"/>
<rect fill="#fce3e3" x="175.44" y="89.2" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#e00" x="185" y="95.88" width="5.16" height="17.62" rx="2" ry="2"/>
<rect fill="#e00" x="194.72" y="95.88" width="5.16" height="17.62" rx="2" ry="2"/>
<circle fill="#e00" cx="261.54" cy="98.66" r="2.73"/>
<circle fill="#e00" cx="269.17" cy="98.66" r="2.73"/>
<rect fill="#fce3e3" x="175.44" y="125.23" width="103.41" height="30.98" rx="3" ry="3"/>
<rect fill="#e00" x="185" y="131.91" width="5.16" height="17.62" rx="2" ry="2"/>
<rect fill="#e00" x="194.72" y="131.91" width="5.16" height="17.62" rx="2" ry="2"/>
<circle fill="#e00" cx="261.54" cy="134.69" r="2.73"/>
<circle fill="#e00" cx="269.17" cy="134.69" r="2.73"/>
<path stroke="#e0e0e0" fill="#fff" d="M515.7 74.04c-4.48 0-8.81.68-12.88 1.93-9.8-18.42-29.18-30.97-51.5-30.97-24.83 0-46.02 15.53-54.42 37.4-15.87.53-29.38 10.38-35.2 24.26a27.9 27.9 0 0 0-6.94-.87c-15.41 0-27.91 12.49-27.91 27.91 0 15.41 12.5 27.91 27.91 27.91h160.95c24.18 0 43.78-19.6 43.78-43.78s-19.6-43.78-43.78-43.78Z"/>
</g>
</svg>
<h3 slot="header">Migrate virtual machines with minimal disruption</h3>
<p>Moving your VMs to a unified platform will help you reliably and flexibly deploy applications across the hybrid cloud.</p>
<rh-cta slot="footer" href="#">Call to action</rh-cta>
</rh-card>
</div>

<style>
.flex {
display: flex;
gap: var(--rh-space-2xl);
}
</style>

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

1 change: 1 addition & 0 deletions elements/rh-card/rh-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
container-name: card;
container-type: inline-size;
height: max-content;
width: 100%;
}

#header.empty,
Expand Down
3 changes: 2 additions & 1 deletion elements/rh-card/rh-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class RhCard extends LitElement {
const computedPalette = this.#computedPalette;
const computedContext = this.#computedContext;
const on = computedContext ?? this.on ?? 'light';
const { variant = '' } = this;
const { variant = '', fullWidth = '' } = this;
const hasHeader = this.#slots.hasSlotted('header');
const hasFooter = this.#slots.hasSlotted('footer');
const hasImage = this.#slots.hasSlotted('image');
Expand All @@ -137,6 +137,7 @@ export class RhCard extends LitElement {
'on': true,
[on]: true,
[variant]: !!variant,
'full-width': fullWidth,
[`palette-${computedPalette}`]: !!computedPalette,
'palette': !!this.colorPalette,
'has-body': hasBody,
Expand Down
Loading