Skip to content

Commit

Permalink
feat(ld-card): zero-padding
Browse files Browse the repository at this point in the history
Resolves #810
  • Loading branch information
borisdiakur committed Jul 20, 2023
1 parent ebff98a commit a090c00
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 4 deletions.
26 changes: 26 additions & 0 deletions screenshot/builds/master.json
Original file line number Diff line number Diff line change
Expand Up @@ -9663,6 +9663,32 @@
"isLandscape": false,
"isMobile": false
},
{
"id": "abeef848",
"image": "e5f588e5ea2b00fdc592cda83d4fbb83.png",
"userAgent": "default",
"desc": "ld-card size zero-padding card CSS Component",
"testPath": "./src/liquid/components/ld-card/test/ld-card.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "2b171cd2",
"image": "e5f588e5ea2b00fdc592cda83d4fbb83.png",
"userAgent": "default",
"desc": "ld-card size zero-padding card Web Component",
"testPath": "./src/liquid/components/ld-card/test/ld-card.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "ac3712f8",
"image": "ff3ae1826f2d6a3182e7ccb109551233.png",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions src/liquid/components/ld-card/ld-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
--ld-card-bg-col: var(--ld-col-wht);
--ld-card-border-radius: var(--ld-br-l);
--ld-card-padding: var(--ld-sp-32);
--ld-card-padding-sm: var(--ld-sp-16);

appearance: none;
border: none;
Expand Down Expand Up @@ -34,6 +33,10 @@
}
}

slot {
border-radius: inherit;
}

:host(.ld-card--sticky)::before,
.ld-card--sticky::before,
:host(.ld-card--interactive-sticky)::after,
Expand Down Expand Up @@ -73,6 +76,13 @@
.ld-card--sm {
:host(&),
& {
padding: var(--ld-card-padding-sm);
--ld-card-padding: var(--ld-sp-16);
}
}

.ld-card--zero {
:host(&),
& {
--ld-card-padding: 0px;
}
}
2 changes: 1 addition & 1 deletion src/liquid/components/ld-card/ld-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class LdCard {
@Prop() shadowInteractive?: 'active' | 'hover' | 'stacked' | 'sticky'

/** The size prop effects the card padding only. */
@Prop() size?: 'sm'
@Prop() size?: 'sm' | 'zero'

componentWillLoad() {
if (this.el.parentElement?.tagName === 'LD-CARD-STACK') {
Expand Down
28 changes: 27 additions & 1 deletion src/liquid/components/ld-card/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ The `size` prop effects the card padding only.
<ld-typo>Lorem ipsum dolor sit amet.</ld-typo>
</ld-card>

<ld-card size="zero">
<img
style="border-radius: inherit"
src="https://picsum.photos/id/152/180/80"
alt=""
/>
</ld-card>

<!-- React component -->

<LdCard>
Expand All @@ -61,6 +69,16 @@ The `size` prop effects the card padding only.
<LdTypo>Lorem ipsum dolor sit amet.</LdTypo>
</LdCard>

<LdCard size="zero">
<img
style={ {
borderRadius: 'inherit'
} }
src="https://picsum.photos/id/152/180/80"
alt=""
/>
</LdCard>

<!-- CSS component -->

<div class="ld-card">
Expand All @@ -70,6 +88,14 @@ The `size` prop effects the card padding only.
<div class="ld-card ld-card--sm">
<p class="ld-typo ld-typo--body-m">Lorem ipsum dolor sit amet.</p>
</div>

<div class="ld-card ld-card--zero">
<img
style="border-radius: inherit"
src="https://picsum.photos/id/152/180/80"
alt=""
/>
</div>
{% endexample %}

## Shadow
Expand Down Expand Up @@ -195,7 +221,7 @@ Use the `shadow-interactive` prop for a transition to a different shadow on hove
| `ref` | `ref` | reference to component | `any` | `undefined` |
| `shadow` | `shadow` | Simulates card elevation by setting the size of the card box shadow. | `"active" \| "hover" \| "stacked" \| "sticky"` | `'stacked'` |
| `shadowInteractive` | `shadow-interactive` | Adds hover and focus-within states using an elevation transition from `shadow` (see above) to `shadowInteractive`. | `"active" \| "hover" \| "stacked" \| "sticky"` | `undefined` |
| `size` | `size` | The size prop effects the card padding only. | `"sm"` | `undefined` |
| `size` | `size` | The size prop effects the card padding only. | `"sm" \| "zero"` | `undefined` |


----------------------------------------------
Expand Down
33 changes: 33 additions & 0 deletions src/liquid/components/ld-card/test/ld-card.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,39 @@ describe('ld-card', () => {
const results = await page.compareScreenshot()
expect(results).toMatchScreenshot()
})

it('zero-padding card Web Component', async () => {
const page = await getPageWithContent(
`<ld-card size="zero-padding">
<img
style="border-radius: inherit"
src="https://picsum.photos/id/152/180/80"
alt=""
/>
</ld-card>`
)

const results = await page.compareScreenshot()
expect(results).toMatchScreenshot()
})

it('zero-padding card CSS Component', async () => {
const page = await getPageWithContent(
`<div class="ld-card ld-card--zero">
<img
style="border-radius: inherit"
src="https://picsum.photos/id/152/180/80"
alt=""
/>
</div>`,
{
components: [LdCard, LdTypo],
}
)

const results = await page.compareScreenshot()
expect(results).toMatchScreenshot()
})
})

describe('shadow', () => {
Expand Down

1 comment on commit a090c00

@vercel
Copy link

@vercel vercel bot commented on a090c00 Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

liquid – ./

liquid-oxygen.vercel.app
liquid-uxsd.vercel.app
liquid-git-main-uxsd.vercel.app

Please sign in to comment.