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): add appearance to card (VIV-000) #1621

Closed
wants to merge 4 commits into from
Closed
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
10 changes: 10 additions & 0 deletions libs/components/src/lib/card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ Add a `text` attribute to add text to the card.
<vwc-card headline="Vivid Card Component" subtitle="Extra text below the card headline" text="The card can contain multiple lines of text."></vwc-card>
```

### With-Hover

```html preview
<vwc-layout>
<vwc-card with-hover appearance="elevated" headline="Vivid Card - Appearance Elevated" subtitle="this is the default appearance"></vwc-card>
<vwc-card with-hover appearance="outlined" headline="Vivid Card - Appearance Outlined" subtitle="set a border to the card same as elevation='0' "></vwc-card>
<vwc-card with-hover appearance="ghost" headline="Vivid Card - Appearance Ghost" subtitle="present the card template without background or shadow"></vwc-card>
</vwc-layout>
```

## Slots

### Graphic
Expand Down
19 changes: 19 additions & 0 deletions libs/components/src/lib/card/card.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
@use "../../../../../dist/libs/tokens/scss/tokens.constants" as constants;
@use "partials/card-variables" as card-variables;
@use "../../../../shared/src/lib/sass/mixins/border-radius" as border-radius-variables;
@use "../../../../shared/src/lib/sass/mixins/connotation/config" with (
$connotations: cta,
$shades: primary primary-text primary-increment faint soft,
$default: cta,
);
@use "../../../../shared/src/lib/sass/mixins/connotation" as connotation;
@use "../../../../shared/src/lib/sass/mixins/appearance/config" as appearance-config with (
$appearances: ghost,
$states: idle hover active,
$default: ghost,
);
@use "../../../../shared/src/lib/sass/mixins/appearance" as appearance;

:host {
display: flex;
Expand All @@ -13,12 +25,19 @@
}

.wrapper {
@include appearance.appearance;
@include connotation.connotation (card);

display: flex;
overflow: hidden;
flex-flow: column;
border-radius: inherit;
block-size: 100%;
color: var(#{constants.$vvd-color-canvas-text});

:host([with-hover]) & {
background-color: var(#{appearance.get-appearance-token(fill)});
}
}

.main-content {
Expand Down
Loading