Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
<daff-card [color]="colorControl.value">
<daff-card [color]="cardControl.value">
<div daffCardTagline>Card Tagline</div>
<div daffCardTitle>Title</div>
<div daffCardContent>
<p>Cards are themable.</p>
</div>
</daff-card>

<select [formControl]="colorControl">
<select [formControl]="cardControl">
<option *ngFor="let option of options" [value]="option.value">{{ option.label }}</option>
</select>

<daff-stroked-card [color]="strokedCardControl.value">
<div daffCardTagline>Card Tagline</div>
<div daffCardTitle>Title</div>
<div daffCardContent>
<p>Cards are themable.</p>
</div>
</daff-stroked-card>

<select [formControl]="strokedCardControl">
<option *ngFor="let option of options" [value]="option.value">{{ option.label }}</option>
</select>
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,31 @@ import {
ReactiveFormsModule,
} from '@angular/forms';

import { DAFF_CARD_COMPONENTS } from '@daffodil/design/card';
import {
DAFF_CARD_COMPONENTS,
DAFF_STROKED_CARD_COMPONENTS,
} from '@daffodil/design/card';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'card-theming',
templateUrl: './card-theming.component.html',
styles: [`
daff-card {
daff-card, daff-stroked-card {
max-width: 480px;
}
`],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
DAFF_CARD_COMPONENTS,
DAFF_STROKED_CARD_COMPONENTS,
ReactiveFormsModule,
NgFor,
],
})
export class CardThemingComponent {
colorControl: UntypedFormControl = new UntypedFormControl('');
cardControl: UntypedFormControl = new UntypedFormControl('');
strokedCardControl: UntypedFormControl = new UntypedFormControl('');

options = [
{ value: '', label: 'Default' },
Expand All @@ -36,7 +41,7 @@ export class CardThemingComponent {
{ value: 'tertiary', label: 'Tertiary' },
{ value: 'theme', label: 'Theme' },
{ value: 'theme-contrast', label: 'Theme Contrast' },
{ value: 'black', label: 'Black' },
{ value: 'white', label: 'White' },
{ value: 'dark', label: 'Dark' },
{ value: 'light', label: 'Light' },
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class LinkableCardComponent {
{ value: 'tertiary', label: 'Tertiary' },
{ value: 'theme', label: 'Theme' },
{ value: 'theme-contrast', label: 'Theme Contrast' },
{ value: 'black', label: 'Black' },
{ value: 'white', label: 'White' },
{ value: 'dark', label: 'Dark' },
{ value: 'light', label: 'Light' },
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class RaisedCardComponent {
{ value: 'tertiary', label: 'Tertiary' },
{ value: 'theme', label: 'Theme' },
{ value: 'theme-contrast', label: 'Theme Contrast' },
{ value: 'black', label: 'Black' },
{ value: 'white', label: 'White' },
{ value: 'dark', label: 'Dark' },
{ value: 'light', label: 'Light' },
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class StrokedCardComponent {
{ value: 'tertiary', label: 'Tertiary' },
{ value: 'theme', label: 'Theme' },
{ value: 'theme-contrast', label: 'Theme Contrast' },
{ value: 'black', label: 'Black' },
{ value: 'white', label: 'White' },
{ value: 'dark', label: 'Dark' },
{ value: 'light', label: 'Light' },
];
}
181 changes: 126 additions & 55 deletions libs/design/card/src/card-base-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,46 @@
$white: core.daff-map-get($theme, 'core', 'white');
$black: core.daff-map-get($theme, 'core', 'black');
$neutral: core.daff-map-get($theme, 'core', 'neutral');
$type: core.daff-map-get($theme, 'core', 'type');

.daff-card,
.daff-raised-card,
.daff-stroked-card {
@include daff-basic-card-theme-variant(
theming.daff-illuminate($base, $neutral, 1)
);

&.daff-primary {
@include daff-basic-card-theme-variant(theming.daff-color($primary));
}
.daff-raised-card {
@include theming.light($type) {
@include daff-basic-card-theme-variant(theming.daff-color($neutral, 10));

&.daff-primary {
@include daff-basic-card-theme-variant(theming.daff-color($primary));
}

&.daff-secondary {
@include daff-basic-card-theme-variant(theming.daff-color($secondary));
&.daff-secondary {
@include daff-basic-card-theme-variant(theming.daff-color($secondary));
}

&.daff-tertiary {
@include daff-basic-card-theme-variant(theming.daff-color($tertiary));
}
}

&.daff-tertiary {
@include daff-basic-card-theme-variant(theming.daff-color($tertiary));
@include theming.dark($type) {
@include daff-basic-card-theme-variant(theming.daff-color($neutral, 90));

&.daff-primary {
@include daff-basic-card-theme-variant(
theming.daff-color($primary, 60)
);
}

&.daff-secondary {
@include daff-basic-card-theme-variant(
theming.daff-color($secondary, 60)
);
}

&.daff-tertiary {
@include daff-basic-card-theme-variant(
theming.daff-color($tertiary, 60)
);
}
}

&.daff-theme {
Expand All @@ -63,63 +85,112 @@
@include daff-basic-card-theme-variant($base-contrast);
}

&.daff-black {
@include daff-basic-card-theme-variant($black);
&.daff-dark {
@include daff-basic-card-theme-variant(theming.daff-color($neutral, 90));
}

&.daff-white {
@include daff-basic-card-theme-variant($white);
&.daff-light {
@include daff-basic-card-theme-variant(theming.daff-color($neutral, 10));
}
}

a {
&.daff-card,
&.daff-raised-card,
&.daff-stroked-card {
@include daff-linkable-card-theme-variant(
theming.daff-illuminate($base, $neutral, 2)
);

&.daff-primary {
&.daff-raised-card {
@include theming.light($type) {
@include daff-linkable-card-theme-variant(
theming.daff-color($primary, 70)
theming.daff-color($neutral, 20)
);
}

&.daff-secondary {
@include daff-linkable-card-theme-variant(
theming.daff-color($secondary, 70)
);
&.daff-primary {
@include daff-linkable-card-theme-variant(
theming.daff-color($primary, 70)
);
}

&.daff-secondary {
@include daff-linkable-card-theme-variant(
theming.daff-color($secondary, 70)
);
}

&.daff-tertiary {
@include daff-linkable-card-theme-variant(
theming.daff-color($tertiary, 70)
);
}

&.daff-theme {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 10)
);
}

&.daff-theme-contrast {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 100)
);
}

&.daff-dark {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 90)
);
}

&.daff-light {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 10)
);
}
}

&.daff-tertiary {
@include theming.dark($type) {
@include daff-linkable-card-theme-variant(
theming.daff-color($tertiary, 70)
theming.daff-color($neutral, 80)
);
}

&.daff-theme {
@include daff-linkable-card-theme-variant(
theming.daff-illuminate($base, $neutral, 1)
);
}

&.daff-theme-contrast {
@include daff-linkable-card-theme-variant(
theming.daff-illuminate($base-contrast, $neutral, 1)
);
}

&.daff-black {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 100)
);
}

&.daff-white {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 10)
);
&.daff-primary {
@include daff-linkable-card-theme-variant(
theming.daff-color($primary, 70)
);
}

&.daff-secondary {
@include daff-linkable-card-theme-variant(
theming.daff-color($secondary, 70)
);
}

&.daff-tertiary {
@include daff-linkable-card-theme-variant(
theming.daff-color($tertiary, 70)
);
}

&.daff-theme {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 90)
);
}

&.daff-theme-contrast {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 10)
);
}

&.daff-dark {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 100)
);
}

&.daff-light {
@include daff-linkable-card-theme-variant(
theming.daff-color($neutral, 10)
);
}
}
}
}
Expand Down
Loading