Skip to content

Commit b96d161

Browse files
committed
refactor: contact page and style.scss
1 parent 79a8770 commit b96d161

File tree

6 files changed

+37
-61
lines changed

6 files changed

+37
-61
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Here is a link to the most recent Angular style guide https://angular.dev/style-
4848
- Do NOT use `ngStyle`, use `style` bindings instead, for context: https://angular.dev/guide/templates/binding#css-class-and-style-property-bindings
4949
- When you create a new component, create the related component.spec.ts file for unit tests
5050
- When you create a new service, create the related service.spec.ts file for unit tests
51+
- use readonly in all variables when it's possible
5152

5253
### State Management
5354

angular.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
}
3232
],
3333
"styles": [
34-
"src/tailwind.css",
35-
"src/styles.scss"
34+
"src/tailwind.css"
3635
]
3736
},
3837
"configurations": {
Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
2+
3+
const VARIANT_CLASSES = {
4+
primary:
5+
'border-(--color-primary) bg-(--color-primary) text-white hover:border-(--color-primary-hover) hover:bg-(--color-primary-hover) hover:text-white',
6+
secondary:
7+
'border-secondary bg-secondary text-white hover:border-secondary-hover hover:bg-secondary-hover hover:text-white',
8+
telegram: 'border-[#2aabee] bg-[#2aabee] text-white hover:border-[#1d96d4] hover:bg-[#1d96d4] hover:text-white',
9+
'primary-outline':
10+
'border-[#f50000] bg-transparent text-[#f50000] hover:border-[#f50000] hover:bg-[#f50000]/10 hover:text-[#f50000]',
11+
'white-outline': 'border-white bg-transparent text-white hover:border-white hover:bg-white/10',
12+
} as const;
13+
14+
type ButtonVariant = keyof typeof VARIANT_CLASSES;
215

316
@Component({
417
selector: 'app-contact-button',
@@ -10,18 +23,20 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
1023
target="_blank"
1124
[href]="href()"
1225
role="button"
13-
class="w-40"
14-
[class]="buttonClass()"
26+
class="inline-flex w-40 cursor-pointer items-center justify-center gap-2 rounded-(--radius) border-2 px-4 py-2 text-base font-semibold no-underline transition-colors [&_svg]:shrink-0"
27+
[class]="variantClass()"
1528
[attr.aria-label]="ariaLabel()"
1629
>
1730
<ng-content />
1831
</a>
1932
`,
2033
})
2134
export class ContactButtonComponent {
22-
id = input.required<string>();
23-
href = input.required<string>();
24-
ariaLabel = input.required<string>();
25-
buttonClass = input<string>('');
26-
rel = input<string>('noopener');
35+
readonly id = input.required<string>();
36+
readonly href = input.required<string>();
37+
readonly ariaLabel = input.required<string>();
38+
readonly variant = input<ButtonVariant>('primary');
39+
readonly rel = input<string>('noopener');
40+
41+
protected readonly variantClass = computed(() => VARIANT_CLASSES[this.variant()]);
2742
}

src/app/components/contact/contact.component.html

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h2>Contacts</h2>
1010
rel="me noopener"
1111
href="https://t.me/pythoncatania"
1212
ariaLabel="Telegram"
13-
buttonClass="border-[#2aabee] bg-[#2aabee] text-white hover:border-[#1d96d4] hover:bg-[#1d96d4]"
13+
variant="telegram"
1414
>
1515
<app-icon-telegram />Telegram
1616
</app-contact-button>
@@ -22,7 +22,7 @@ <h2>Contacts</h2>
2222
rel="me noopener"
2323
href="https://www.facebook.com/PythonCatania"
2424
ariaLabel="Facebook"
25-
buttonClass="border-secondary bg-secondary hover:border-secondary-hover hover:bg-secondary-hover text-white"
25+
variant="secondary"
2626
>
2727
<app-icon-facebook />Facebook
2828
</app-contact-button>
@@ -31,7 +31,7 @@ <h2>Contacts</h2>
3131
rel="me noopener"
3232
href="https://www.linkedin.com/groups/9895708/"
3333
ariaLabel="LinkedIn"
34-
buttonClass="border-secondary bg-secondary hover:border-secondary-hover hover:bg-secondary-hover text-white"
34+
variant="secondary"
3535
>
3636
<app-icon-linkedin />LinkedIn
3737
</app-contact-button>
@@ -40,7 +40,7 @@ <h2>Contacts</h2>
4040
rel="me noopener"
4141
href="https://www.youtube.com/@pythoncatania"
4242
ariaLabel="YouTube"
43-
buttonClass="border-secondary bg-secondary hover:border-secondary-hover hover:bg-secondary-hover text-white"
43+
variant="secondary"
4444
>
4545
<app-icon-youtube />YouTube
4646
</app-contact-button>
@@ -49,7 +49,7 @@ <h2>Contacts</h2>
4949
rel="me noopener"
5050
href="https://www.instagram.com/pythoncatania/"
5151
ariaLabel="Instagram"
52-
buttonClass="border-secondary bg-secondary hover:border-secondary-hover hover:bg-secondary-hover text-white"
52+
variant="secondary"
5353
>
5454
<app-icon-instagram />Instagram
5555
</app-contact-button>
@@ -58,7 +58,7 @@ <h2>Contacts</h2>
5858
rel="me noopener"
5959
href="https://social.python.it/@pycatania"
6060
ariaLabel="Mastodon"
61-
buttonClass="border-secondary bg-secondary hover:border-secondary-hover hover:bg-secondary-hover text-white"
61+
variant="secondary"
6262
>
6363
<app-icon-mastodon />Mastodon
6464
</app-contact-button>
@@ -68,12 +68,7 @@ <h2>Contacts</h2>
6868
<!-- Column: Code + Networks + Partners -->
6969
<div class="flex flex-col gap-8">
7070
<app-contact-group title="Code">
71-
<app-contact-button
72-
id="github"
73-
rel="me noopener"
74-
href="https://github.com/PythonCatania"
75-
ariaLabel="GitHub"
76-
>
71+
<app-contact-button id="github" rel="me noopener" href="https://github.com/PythonCatania" ariaLabel="GitHub">
7772
<app-icon-github />GitHub
7873
</app-contact-button>
7974
</app-contact-group>
@@ -83,15 +78,15 @@ <h2>Contacts</h2>
8378
id="python-software-foundation"
8479
href="https://www.python.org/"
8580
ariaLabel="Python Software Foundation"
86-
buttonClass="border-[#f50000] bg-transparent text-[#f50000] hover:border-[#f50000] hover:bg-[#f50000]/10 hover:text-[#f50000]"
81+
variant="primary-outline"
8782
>
8883
<app-icon-psf /><abbr title="Python Software Foundation">PSF</abbr>
8984
</app-contact-button>
9085
<app-contact-button
9186
id="python-italia"
9287
href="https://www.python.it/"
9388
ariaLabel="Python Italia"
94-
buttonClass="border-[#f50000] bg-transparent text-[#f50000] hover:border-[#f50000] hover:bg-[#f50000]/10 hover:text-[#f50000]"
89+
variant="primary-outline"
9590
>
9691
<app-icon-python-italia />Python&nbsp;Italia
9792
</app-contact-button>
@@ -102,7 +97,7 @@ <h2>Contacts</h2>
10297
id="pycon-italia"
10398
href="https://www.pycon.it/"
10499
ariaLabel="PyCon Italia"
105-
buttonClass="border-white bg-transparent text-white hover:border-white hover:bg-white/10"
100+
variant="white-outline"
106101
>
107102
<app-icon-pycon-italia />PyCon&nbsp;Italia
108103
</app-contact-button>
@@ -113,7 +108,7 @@ <h2>Contacts</h2>
113108
id="google-developer-group-catania"
114109
href="https://gdg.community.dev/gdg-catania/"
115110
ariaLabel="Google Developer Group Catania"
116-
buttonClass="border-white bg-transparent text-white hover:border-white hover:bg-white/10"
111+
variant="white-outline"
117112
>
118113
<app-icon-gdg /><abbr title="Google Developer Group">GDG</abbr>&nbsp;Catania
119114
</app-contact-button>

src/app/components/meetup/meetup.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ <h2>Meetup</h2>
1111
href="https://www.meetup.com/python-catania/"
1212
role="button"
1313
aria-label="Meetup"
14+
class="inline-flex cursor-pointer items-center justify-center gap-2 rounded-(--radius) border-2 border-(--color-primary) bg-(--color-primary) px-4 py-2 text-base font-semibold text-white no-underline transition-colors hover:border-(--color-primary-hover) hover:bg-(--color-primary-hover) hover:text-white [&_svg]:shrink-0"
1415
>
1516
<app-icon-meetup />Unisciti a noi</a
1617
>

src/styles.scss

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)