Skip to content

Commit e0a2694

Browse files
marcin-hoaDamianBrzezinskiHoA
authored andcommitted
feat: enhance theming support with light/dark variants and gradient options
1 parent 0445dc3 commit e0a2694

File tree

13 files changed

+66
-25
lines changed

13 files changed

+66
-25
lines changed

libs/blog/about-us/feature-about-us/src/lib/feature-about-us/feature-about-us.component.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ <h2 class="text-al-primary-foreground mb-8 mt-10 text-[40px] font-bold">
4141
</ng-container>
4242

4343
@for (author of authorsCards(); track author.slug) {
44-
<al-author-card class="mb-6 block" [author]="author" [linkable]="true" />
44+
<al-author-card
45+
class="mb-6 block"
46+
[author]="author"
47+
[linkable]="true"
48+
[hideGradient]="hideGradientInAuthorCards()"
49+
/>
4550

4651
@if ($index === noAuthorsInView() - 2) {
4752
@defer (on viewport) {

libs/blog/about-us/feature-about-us/src/lib/feature-about-us/feature-about-us.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from '@angular-love/blog/shared/ui-card';
1717
import { InfiniteScrollTriggerDirective } from '@angular-love/blog/shared/ui-pagination';
1818
import { SocialMediaIconsComponent } from '@angular-love/blog/shared/ui-social-media-icons';
19+
import { AppThemeStore } from '@angular-love/data-access-app-theme';
1920

2021
@Component({
2122
selector: 'al-about-us',
@@ -41,6 +42,10 @@ export class FeatureAboutUsComponent implements OnInit {
4142
return this.authorsCards()?.length || 0;
4243
});
4344

45+
readonly theme = inject(AppThemeStore).theme;
46+
47+
readonly hideGradientInAuthorCards = computed(() => this.theme() === 'light');
48+
4449
private readonly _skip = this._authorListStore.skip;
4550
private readonly _total = this._authorListStore.total;
4651
private readonly _pageSize = this._authorListStore.pageSize;

libs/blog/articles/feature-latest-articles/src/lib/feature-latest-articles/feature-latest-articles.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</section>
3838

3939
<div class="flex justify-center gap-3">
40-
<button al-button role="link" [routerLink]="selected().link" size="small">
40+
<button al-button role="link" [routerLink]="selected().link" size="medium">
4141
{{ t('categories.showAll', { category: t(selected().translationPath) }) }}
4242
</button>
4343
</div>
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
import { Component } from '@angular/core';
1+
import { Component, input } from '@angular/core';
22

33
import {
44
CardComponent,
55
CardContentDirective,
6+
GradientCardDirective,
67
} from '@angular-love/blog/shared/ui-card';
78

89
@Component({
910
selector: 'al-author-card-template',
10-
standalone: true,
11-
imports: [CardComponent, CardContentDirective],
11+
imports: [CardComponent, CardContentDirective, GradientCardDirective],
1212
host: {
1313
class: 'block @container',
1414
},
1515
template: `
16-
<al-card>
16+
<al-card alGradientCard [hideGradient]="hideGradient()">
1717
<div alCardContent>
1818
<div
19-
class="@3xl:flex-row @3xl:border-none flex w-full flex-col items-center rounded-lg border"
19+
class="flex w-full flex-col items-center rounded-lg border md:flex-row md:border-none"
2020
>
2121
<div
22-
class="@3xl:border dark:@3xl:!bg-al-radial-gradient dark:@3xl:bg-al-background light:@3xl:bg-[#f2f2f2] @3xl:min-w-[260px] min-w-fit rounded-lg pb-4 pt-6"
22+
class="dark:!bg-al-radial-gradient dark:bg-al-background md:light:bg-[#f2f2f2] min-w-fit rounded-lg pb-4 pt-6 md:min-w-[260px] md:border"
2323
>
2424
<div
25-
class="@3xl:max-w-[360px] flex w-full flex-col items-center gap-4"
25+
class="flex w-full flex-col items-center gap-4 md:max-w-[360px]"
26+
Expand
27+
Down
2628
>
2729
<ng-content select="[author-info-card]"></ng-content>
2830
</div>
2931
</div>
30-
31-
<div
32-
class="@3xl:pt-6 w-full flex-1 hyphens-auto break-words p-6 pt-0"
33-
>
32+
<div class="w-full flex-1 hyphens-auto break-words p-6 pt-0 md:pt-6">
3433
<ng-content select="[author-info-description]"></ng-content>
3534
</div>
3635
</div>
3736
</div>
3837
</al-card>
3938
`,
4039
})
41-
export class AuthorCardTemplateComponent {}
40+
export class AuthorCardTemplateComponent {
41+
hideGradient = input<boolean>(true);
42+
}

libs/blog/authors/ui-author-card/src/lib/author-card/author-card.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<article [attr.aria-labelledby]="'author-title-' + author().slug">
2-
<al-author-card-template>
2+
<al-author-card-template [hideGradient]="hideGradient()">
33
<ng-container author-info-card>
44
@if (linkable()) {
55
<a [routerLink]="['/', 'author', author().slug] | alLocalize">

libs/blog/authors/ui-author-card/src/lib/author-card/author-card.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class AuthorCardComponent {
4545

4646
clampText = input<boolean>();
4747
linkable = input<boolean>(false);
48+
hideGradient = input<boolean>(false);
4849

4950
descriptionClass = computed(
5051
() => 'text-sm' + (this.clampText() ? ' line-clamp-3' : ''),

libs/blog/layouts/ui-layouts/src/lib/footer/components/footer-social-media-icons.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { SocialMediaIconsComponent } from '@angular-love/blog/shared/ui-social-m
1313
>
1414
Social media
1515
</h3>
16-
<al-social-media-icons />
16+
<al-social-media-icons variant="light" />
1717
</div>
1818
`,
1919
changeDetection: ChangeDetectionStrategy.OnPush,

libs/blog/shared/ui-button/src/lib/button/button.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const buttonVariants = cva(
2121
{
2222
variants: {
2323
variant: <Record<AlButtonVariant, string>>{
24-
Primary: 'bg-al-primary/90 text-white font-bold uppercase',
24+
Primary: 'bg-al-primary/90 text-white uppercase',
2525
Secondary: 'bg-al-background border',
2626
Outline: 'border border-al-primary/90 bg-white text-al-primary',
2727
Ghost: 'bg-transparent',

libs/blog/shared/ui-card/src/lib/card.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ export class CardLinkableDirective {
6565
@Directive({
6666
standalone: true,
6767
selector: 'al-card[alGradientCard]',
68+
host: {
69+
'[class.bg-al-radial-gradient]': '!hideGradient()',
70+
},
6871
})
6972
export class GradientCardDirective {
73+
hideGradient = input<boolean>(false);
74+
7075
@HostBinding('class')
71-
get hostClasses() {
72-
return 'bg-al-radial-gradient dark:bg-al-background';
73-
}
76+
hostClasses = 'dark:bg-al-background';
7477
}
7578

7679
@Directive({

libs/blog/shared/ui-social-media-icons/src/lib/social-media-icons.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@for (social of socials; track $index) {
33
<li>
44
<al-social-media-icon-item
5-
class="text-[#fff]"
5+
[class]="iconColorClass()"
66
[socialMediaConfig]="social"
77
/>
88
</li>

0 commit comments

Comments
 (0)