diff --git a/packages/webawesome/docs/docs/components/card.md b/packages/webawesome/docs/docs/components/card.md index 0baa5c6ad..a79a4e368 100644 --- a/packages/webawesome/docs/docs/components/card.md +++ b/packages/webawesome/docs/docs/components/card.md @@ -17,10 +17,8 @@ category: Organization This kitten is as cute as he is playful. Bring him home today!
6 weeks old -
- More Info - -
+ More Info + +``` diff --git a/packages/webawesome/docs/docs/resources/changelog.md b/packages/webawesome/docs/docs/resources/changelog.md index 939135ec8..bc8aa443b 100644 --- a/packages/webawesome/docs/docs/resources/changelog.md +++ b/packages/webawesome/docs/docs/resources/changelog.md @@ -37,6 +37,7 @@ Components with the Experimental badge sh - Fixed a bug in `` that prevent the picker from staying in the viewport - Fixed a bug that in `` that caused `library`, `family`, `variant` and `name` to not reflect [pr:#1395] - Fixed a bug in `` and `` that caused spaces to appear before and after the output [#1417] +- Added horizontal orientation support with `orientation="horizontal"` for `` ## 3.0.0-beta.4 diff --git a/packages/webawesome/src/components/card/card.css b/packages/webawesome/src/components/card/card.css index 2df00d27a..859272bf8 100644 --- a/packages/webawesome/src/components/card/card.css +++ b/packages/webawesome/src/components/card/card.css @@ -77,7 +77,9 @@ } .header { - display: block; + display: flex; + align-items: center; + justify-content: space-between; border-block-end-style: inherit; border-block-end-color: var(--wa-color-surface-border); border-block-end-width: var(--wa-panel-border-width); @@ -90,7 +92,9 @@ } .footer { - display: block; + display: flex; + align-items: center; + justify-content: space-between; border-block-start-style: inherit; border-block-start-color: var(--wa-color-surface-border); border-block-start-width: var(--wa-panel-border-width); @@ -102,3 +106,27 @@ :host(:not([with-media])) .media { display: none; } + +/* Orientation Styles */ +:host([orientation='horizontal']) { + flex-direction: row; + + .media { + border-start-start-radius: var(--inner-border-radius); + border-end-start-radius: var(--inner-border-radius); + border-start-end-radius: 0; + object-fit: cover; + } +} + +:host([orientation='horizontal']) ::slotted([slot='body']) { + display: block; + height: 100%; + margin: 0; +} + +:host([orientation='horizontal']) ::slotted([slot='actions']) { + display: flex; + align-items: center; + padding: var(--spacing); +} diff --git a/packages/webawesome/src/components/card/card.ts b/packages/webawesome/src/components/card/card.ts index c3e3ba5d6..2eabca454 100644 --- a/packages/webawesome/src/components/card/card.ts +++ b/packages/webawesome/src/components/card/card.ts @@ -15,6 +15,9 @@ import styles from './card.css'; * @slot header - An optional header for the card. * @slot footer - An optional footer for the card. * @slot media - An optional media section to render at the start of the card. + * @slot actions - An optional actions section to render at the end for the horizontal card. + * @slot header-actions - An optional actions section to render in the header of the vertical card. + * @slot footer-actions - An optional actions section to render in the footer of the vertical card. * * @csspart media - The container that wraps the card's media. * @csspart header - The container that wraps the card's header. @@ -42,6 +45,10 @@ export default class WaCard extends WebAwesomeElement { /** Renders the card with a footer. Only needed for SSR, otherwise is automatically added. */ @property({ attribute: 'with-footer', type: Boolean, reflect: true }) withFooter = false; + /** Renders the card's orientation **/ + @property({ reflect: true }) + orientation: 'horizontal' | 'vertical' = 'vertical'; + updated() { // Enable the respective slots when detected if (!this.withHeader && this.hasSlotController.test('header')) this.withHeader = true; @@ -50,11 +57,27 @@ export default class WaCard extends WebAwesomeElement { } render() { + // Horizontal Orientation + if (this.orientation === 'horizontal') { + return html` + + + + `; + } + + // Vertical Orientation return html` - +
+ + +
- + `; } }