Skip to content

Commit 747318b

Browse files
marcin-hoamaja
andauthored
feat: newsletter page (#451)
Co-authored-by: maja <[email protected]>
1 parent 392c020 commit 747318b

File tree

15 files changed

+6391
-39
lines changed

15 files changed

+6391
-39
lines changed

apps/blog/src/assets/i18n/en.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"about": "About us",
2626
"meetups": "Angular Meetups",
2727
"become_author": "Become an author",
28+
"newsletter": "Angular.letter",
2829
"navLinks": "Navigation links",
2930
"languagePicker": {
3031
"pl": "Polish",
@@ -95,15 +96,28 @@
9596
"title": "Sign up for our newsletter",
9697
"description": "Stay up-to-date with the trends and be a part of a thriving community.",
9798
"emailPlaceholder": "Your E-mail",
99+
"namePlaceholder": "Your Name",
98100
"submitLabel": "Submit and sign up for a newsletter",
99101
"label": "Consent to process email for newsletter.",
100102
"consent": "I consent to Angular.love processing my email address for the purpose of sending the newsletter.",
101103
"error": "Something went wrong. Please try again."
102104
},
103105
"newsletterPage": {
104-
"title": "You have correctly signed up for the newsletter",
105-
"description": "From now on you will be up to date with all the information we will make available on the blog.",
106-
"button": "Return to the home page"
106+
"title": "Newsletter Angular.love",
107+
"subtitle": "Join Angular.letter and get insights every 2 weeks",
108+
"description1": "Staying up to date with Angular takes time - we know this because we work with it every day.",
109+
"description2": "That’s why we created <b>Angular.letter</b> - a short, curated update <b>written by developers from Angular.love community</b> for developers like you.",
110+
"description3": "It’s sent once every two weeks at most and is packed with only the essentials:",
111+
"subsection1": "top news,",
112+
"subsection2": "Angular practical tips, ",
113+
"subsection3": "event invitations: meetups, conferences, Angular Camps",
114+
"subsection4": "Conference ticket discounts for community members.",
115+
"sampleNewsletters": "Check out sample newsletters:",
116+
"success": {
117+
"title": "Thank you for subscribing!",
118+
"description": "You've successfully subscribed to our newsletter. We'll send you an email with the latest news and updates.",
119+
"button": "Return to the home page"
120+
}
107121
},
108122
"notFoundPage": {
109123
"title": "404",

apps/blog/src/assets/i18n/pl.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"about": "O nas",
2626
"meetups": "Angular Meetups",
2727
"become_author": "Zostań autorem",
28+
"newsletter": "Angular.letter",
2829
"navLinks": "Menu",
2930
"languagePicker": {
3031
"pl": "Polski",
@@ -98,15 +99,28 @@
9899
"title": "Zapisz się na nasz newsletter",
99100
"description": "Dołącz do community Angular.love i bądź na bieżąco z trendami.",
100101
"emailPlaceholder": "Twój e-mail",
102+
"namePlaceholder": "Twoje imię",
101103
"submitLabel": "Wyślij i zapisz się na newsletter",
102104
"label": "Zgoda na przetwarzanie adresu email do newslettera.",
103105
"consent": "Wyrażam zgodę na przetwarzanie mojego adresu e-mail przez Angular.love w celu wysyłki newslettera.",
104106
"error": "Ups... coś poszło nie tak. Spróbuj ponownie."
105107
},
106108
"newsletterPage": {
107-
"title": "Pomyślnie zapisałeś się na newsletter!",
108-
"description": "Od teraz będziesz na bieżąco ze wszystkimi informacjami jakie będziemy udostępniać na blogu.",
109-
"button": "Powrót na stronę główną"
109+
"title": "Newsletter Angular.love",
110+
"subtitle": "Dołącz do Angular.letter i co dwa tygodnie otrzymuj solidną dawkę wiedzy o Angularze",
111+
"description1": "Bycie na bieżąco z Angularem wymaga czasu - wiemy o tym, ponieważ pracujemy z nim na co dzień.",
112+
"description2": "Dlatego stworzyliśmy <b>Angular.letter</b> - newsletter <b>pisany przez programistów z community Angular.love</b> dla programistów takich jak Ty.",
113+
"description3": "Newsletter wysyłany jest maksymalnie raz na dwa tygodnie i zawiera tylko najciekawsze informacje:",
114+
"subsection1": "Najważniejsze wiadomości,",
115+
"subsection2": "Praktyczne wskazówki dotyczące Angulara,",
116+
"subsection3": "Zaproszenia na wydarzenia: spotkania, konferencje, Angular Camps",
117+
"subsection4": "Zniżki na bilety konferencyjne dla członków społeczności.",
118+
"sampleNewsletters": "Zobacz nasze przykładowe newslettery:",
119+
"success": {
120+
"title": "Pomyślnie zapisałeś się na newsletter!",
121+
"description": "Od teraz będziesz na bieżąco ze wszystkimi informacjami jakie będziemy udostępniać na blogu.",
122+
"button": "Powrót na stronę główną"
123+
}
110124
},
111125
"notFoundPage": {
112126
"title": "404",

libs/blog/layouts/ui-layouts/src/lib/header/header.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
>
2828
<al-header-logo />
2929
30-
<al-navigation class="hidden lg:block" />
30+
<al-navigation class="hidden lg:block" [showNewsletter]="false" />
3131
3232
<div class="flex flex-row items-center">
3333
<al-language-picker

libs/blog/layouts/ui-navigation/src/lib/navigation/navigation.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}"
1313
[attr.aria-label]="t('nav.navLinks')"
1414
>
15-
@for (item of navItems; track $index) {
15+
@for (item of filteredNavItems(); track $index) {
1616
@if (!item.externalLink) {
1717
<li
1818
[ngClass]="{

libs/blog/layouts/ui-navigation/src/lib/navigation/navigation.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { NgClass } from '@angular/common';
22
import {
33
ChangeDetectionStrategy,
44
Component,
5+
computed,
56
input,
67
output,
78
} from '@angular/core';
@@ -15,6 +16,7 @@ export type NavItem = {
1516
link: string[];
1617
dataTestId: string;
1718
externalLink?: boolean;
19+
showElement?: boolean;
1820
};
1921

2022
@Component({
@@ -32,6 +34,14 @@ export type NavItem = {
3234
})
3335
export class NavigationComponent {
3436
readonly layout = input<'vertical' | 'horizontal'>('horizontal');
37+
showNewsletter = input(true);
38+
39+
readonly filteredNavItems = computed(() => {
40+
return this.navItems.filter(
41+
(item) =>
42+
item.translationPath !== 'nav.newsletter' || this.showNewsletter(),
43+
);
44+
});
3545

3646
readonly navItems: NavItem[] = [
3747
{
@@ -50,6 +60,11 @@ export class NavigationComponent {
5060
link: ['become-author'],
5161
dataTestId: 'navigation-become-author',
5262
},
63+
{
64+
translationPath: 'nav.newsletter',
65+
link: ['newsletter'],
66+
dataTestId: 'navigation-newsletter',
67+
},
5368
];
5469
protected navigated = output();
5570
}

libs/blog/newsletter/feature-newsletter/src/lib/feature-newsletter/newsletter.component.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
<p class="py-4">{{ t('description') }}</p>
1313
<fieldset>
1414
<legend class="hidden">Newsletter sign up form</legend>
15+
16+
<input
17+
aria-required="true"
18+
type="text"
19+
class="bg-al-background text-al-muted border-al-border my-2 h-[60px] w-full flex-grow rounded-md border p-6 text-sm focus:outline-none"
20+
[attr.aria-label]="t('namePlaceholder')"
21+
[placeholder]="t('namePlaceholder')"
22+
formControlName="name"
23+
/>
24+
1525
<div class="my-2 flex w-full flex-row">
1626
<input
1727
aria-required="true"
@@ -58,6 +68,11 @@
5868
class="border-al-muted mr-2 mt-1 flex aspect-square h-[14px] items-center justify-center rounded border"
5969
[attr.aria-label]="t('label')"
6070
[attr.aria-checked]="form.controls.checkbox.value"
71+
(click)="
72+
form.controls['checkbox'].setValue(
73+
!form.controls['checkbox'].value
74+
)
75+
"
6176
(keydown.enter)="
6277
form.controls['checkbox'].setValue(
6378
!form.controls['checkbox'].value

libs/blog/newsletter/feature-newsletter/src/lib/feature-newsletter/newsletter.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ import { NewsletterStore } from '@angular-love/data-access';
3838
})
3939
export class NewsletterComponent {
4040
protected readonly form = new FormGroup({
41+
name: new FormControl<string>('', {
42+
validators: [Validators.required],
43+
}),
4144
email: new FormControl<string>('', {
4245
validators: [
4346
Validators.required,

0 commit comments

Comments
 (0)