Skip to content

feat: add static top banner for new ebook edition promotion #405

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

Merged
merged 1 commit into from
Mar 18, 2025
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
1 change: 1 addition & 0 deletions libs/blog/ad-banner/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './lib/ad-image-banner/ad-image-banner.component';
export * from './lib/ad-image-banner/ad-image-banner-data.interface';
export * from './lib/banner-carousel/al-banner-carousel.component';
export * from './lib/top-banner.component';
19 changes: 19 additions & 0 deletions libs/blog/ad-banner/ui/src/lib/top-banner.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component } from '@angular/core';

@Component({
selector: 'al-top-banner',
template: `
<a
class="flex w-full flex-wrap justify-center gap-[5px] px-[10px] py-3 text-[18px] font-medium text-white"
style="background-image: linear-gradient(0.25turn, #fe5758, #8d52fe)"
href="https://houseofangular.io/the-ultimate-guide-to-angular-evolution/?utm_source=www-al&utm_medium=baner&utm_campaign=angular19-evolution"
>
<span>Enhance Your Project with</span>
<span class="rounded-[4px] bg-white px-[6px] text-[#f9506a]">
Angular 19
</span>
<span class="underline">Download a free ebook!</span>
</a>
`,
})
export class TopBannerComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import { SearchComponent } from '@angular-love/blog/search/feature-search';
import {
AdImageBanner,
AlBannerCarouselComponent,
TopBannerComponent,
} from '@angular-love/blog/shared/ad-banner';

@Component({
selector: 'al-root-shell',
template: `
<div class="fixed top-0 z-10 w-full">
<al-top-banner #topBanner />
<div class="sticky top-0 z-10 w-full">
<al-header
class="block w-full"
[language]="language()"
Expand All @@ -30,7 +32,7 @@ import {
<al-search />
</al-header>
</div>
<al-layout class="mt-20" [ngClass]="{ 'mt-40': adBannerVisible() }">
<al-layout class="mt-0" [ngClass]="{ 'mt-20': adBannerVisible() }">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Banner visibility logic needs attention.

The adBannerVisible() computed value is hardcoded to return false, which means the conditional margin class mt-20 will never be applied. If the top banner should affect the layout, this needs to be updated.

Update the adBannerVisible computed property to reflect the actual visibility of the banner:

// todo: temporary solution to keep in mind how banner influence the layout
-protected readonly adBannerVisible = computed(() => false);
+protected readonly adBannerVisible = computed(() => true); // or implement actual logic

Alternatively, if the banner should always be visible, consider removing the conditional and directly applying the desired margin:

-<al-layout class="mt-0" [ngClass]="{ 'mt-20': adBannerVisible() }">
+<al-layout class="mt-20">

Also applies to: 76-77

@if (slides()?.length && slides(); as slides) {
<al-banner-carousel
class="mb-4 inline-block"
Expand All @@ -50,6 +52,7 @@ import {
SearchComponent,
NgClass,
AlBannerCarouselComponent,
TopBannerComponent,
],
})
export class RootShellComponent {
Expand Down