@gardev/components 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ng-package.json +7 -0
- package/package.json +12 -26
- package/src/lib/components/bottle/bottle.component.css +4 -0
- package/src/lib/components/bottle/bottle.component.html +1 -0
- package/src/lib/components/bottle/bottle.component.spec.ts +23 -0
- package/src/lib/components/bottle/bottle.component.ts +164 -0
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.component.css +23 -0
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.component.html +5 -0
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.component.ts +63 -0
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.spec.ts +23 -0
- package/src/lib/components/caroussel/caroussel.component.css +11 -0
- package/src/lib/components/caroussel/caroussel.component.html +8 -0
- package/src/lib/components/caroussel/caroussel.component.ts +24 -0
- package/src/lib/components/cronogram/cronogram.component.css +58 -0
- package/src/lib/components/cronogram/cronogram.component.html +47 -0
- package/src/lib/components/cronogram/cronogram.component.spec.ts +23 -0
- package/src/lib/components/cronogram/cronogram.component.ts +99 -0
- package/src/lib/components/stack-caroussel/stack-caroussel.css +25 -0
- package/src/lib/components/stack-caroussel/stack-caroussel.html +4 -0
- package/src/lib/components/stack-caroussel/stack-caroussel.spec.ts +23 -0
- package/src/lib/components/stack-caroussel/stack-caroussel.ts +50 -0
- package/src/lib/layouts/menu/menu.component.css +50 -0
- package/src/lib/layouts/menu/menu.component.html +21 -0
- package/src/lib/layouts/menu/menu.component.ts +98 -0
- package/src/lib/layouts/menu/menu.spec.ts +23 -0
- package/src/lib/layouts/navbar/navbar.component.css +34 -0
- package/src/lib/layouts/navbar/navbar.component.html +10 -0
- package/src/lib/layouts/navbar/navbar.component.spec.ts +23 -0
- package/src/lib/layouts/navbar/navbar.component.ts +46 -0
- package/src/lib/layouts/page-layout/page-layout.component.css +13 -0
- package/src/lib/layouts/page-layout/page-layout.component.html +32 -0
- package/src/lib/layouts/page-layout/page-layout.component.spec.ts +23 -0
- package/src/lib/layouts/page-layout/page-layout.component.ts +13 -0
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.css +0 -0
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.html +10 -0
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.spec.ts +23 -0
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.ts +40 -0
- package/src/lib/layouts/section/section.component.css +0 -0
- package/src/lib/layouts/section/section.component.html +10 -0
- package/src/lib/layouts/section/section.component.spec.ts +23 -0
- package/src/lib/layouts/section/section.component.ts +12 -0
- package/src/lib/theme.service.ts +22 -0
- package/src/public-api.ts +14 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/ardev-components.mjs +0 -575
- package/fesm2022/ardev-components.mjs.map +0 -1
- package/types/ardev-components.d.ts +0 -139
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { StackCaroussel } from './stack-caroussel';
|
|
4
|
+
|
|
5
|
+
describe('StackCaroussel', () => {
|
|
6
|
+
let component: StackCaroussel;
|
|
7
|
+
let fixture: ComponentFixture<StackCaroussel>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [StackCaroussel]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(StackCaroussel);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ard-stack-caroussel',
|
|
6
|
+
imports: [CommonModule],
|
|
7
|
+
templateUrl: './stack-caroussel.html',
|
|
8
|
+
styleUrl: './stack-caroussel.css',
|
|
9
|
+
})
|
|
10
|
+
export class StackCaroussel {
|
|
11
|
+
@Input() images: string[] = [];
|
|
12
|
+
@Input() atmospheric = false;
|
|
13
|
+
|
|
14
|
+
animating = false;
|
|
15
|
+
|
|
16
|
+
getOffset(index: number) {
|
|
17
|
+
return {
|
|
18
|
+
transform: `translate(${index * 16}px, ${index * 16}px)`,
|
|
19
|
+
zIndex: this.images.length - index,
|
|
20
|
+
opacity: this.atmospheric
|
|
21
|
+
? 1 - (this.images.length - index * 0.08)
|
|
22
|
+
: 1
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
rotateStack() {
|
|
27
|
+
if (this.animating || this.images.length === 0) return;
|
|
28
|
+
|
|
29
|
+
this.animating = true;
|
|
30
|
+
|
|
31
|
+
const last = this.images[this.images.length - 1];
|
|
32
|
+
const rest = this.images.slice(0, this.images.length - 1);
|
|
33
|
+
|
|
34
|
+
// Fase 1
|
|
35
|
+
const el = document.querySelector('.img-last') as HTMLElement;
|
|
36
|
+
if (el) {
|
|
37
|
+
el.classList.add('move-out');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
// Reordenem array
|
|
42
|
+
this.images = [last, ...rest];
|
|
43
|
+
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
this.animating = false;
|
|
46
|
+
}, 50);
|
|
47
|
+
|
|
48
|
+
}, 300);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
ul {
|
|
2
|
+
list-style-type: none;
|
|
3
|
+
display: flex;
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
a {
|
|
9
|
+
color: var(--menu-text);
|
|
10
|
+
text-decoration: none;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
a:hover {
|
|
15
|
+
text-decoration: underline;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
button {
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-self: end;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
li::after {
|
|
24
|
+
content: '';
|
|
25
|
+
margin-left: 1rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#menu-container {
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host {
|
|
35
|
+
width: 100%;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#dropdown {
|
|
40
|
+
li {
|
|
41
|
+
list-style-type: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
;
|
|
45
|
+
background: white;
|
|
46
|
+
border-radius: 1rem;
|
|
47
|
+
border: 1px solid black;
|
|
48
|
+
padding: 1rem;
|
|
49
|
+
margin: 0 1rem;
|
|
50
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div #menuContainer id="menu-container">
|
|
2
|
+
@if(!collapsed) {
|
|
3
|
+
<ul #unorderedList [style.flexFlow]="direction == 'horizontal' ? 'row' : 'column'"
|
|
4
|
+
[style.justifySelf]="justifySelf">
|
|
5
|
+
@for (i of menu; track i.label) {
|
|
6
|
+
<li><a [href]="i.path">{{i.label}}</a></li>
|
|
7
|
+
}
|
|
8
|
+
</ul>
|
|
9
|
+
} @else {
|
|
10
|
+
<button #overlayTrigger [style.justifySelf]="justifySelf" (click)="toggleMenu()">Menu</button>
|
|
11
|
+
|
|
12
|
+
<ng-template #menuOverlay>
|
|
13
|
+
<div id="dropdown">
|
|
14
|
+
@for (i of menu; track i.label) {
|
|
15
|
+
<li><a [href]="i.path">{{i.label}}</a></li>
|
|
16
|
+
}
|
|
17
|
+
</div>
|
|
18
|
+
</ng-template>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Inject, Component, ElementRef, HostListener, Input, ViewChild, AfterViewInit, ChangeDetectorRef, inject, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { Overlay, OverlayRef } from '@angular/cdk/overlay';
|
|
3
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ard-menu',
|
|
6
|
+
templateUrl: './menu.component.html',
|
|
7
|
+
styleUrl: './menu.component.css',
|
|
8
|
+
})
|
|
9
|
+
export class MenuComponent implements AfterViewInit {
|
|
10
|
+
|
|
11
|
+
@Input() justifySelf: 'center' | 'end' | 'start' = 'end';
|
|
12
|
+
@Input() menu?: {
|
|
13
|
+
path: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}[] = [
|
|
16
|
+
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
@Input() direction: 'horizontal' | 'vertical' = 'horizontal';
|
|
20
|
+
|
|
21
|
+
@ViewChild('menuContainer') menuContainer!: ElementRef<HTMLElement>;
|
|
22
|
+
@ViewChild('unorderedList') unorderedList!: ElementRef<HTMLElement>;
|
|
23
|
+
|
|
24
|
+
constructor(private cdr: ChangeDetectorRef) { }
|
|
25
|
+
|
|
26
|
+
collapsed = false;
|
|
27
|
+
listWidth = 0;
|
|
28
|
+
|
|
29
|
+
ngAfterViewInit() {
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.getWidth();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@HostListener('window:resize')
|
|
36
|
+
getWidth() {
|
|
37
|
+
const containerWidth =
|
|
38
|
+
this.menuContainer.nativeElement.getBoundingClientRect().width;
|
|
39
|
+
|
|
40
|
+
if (!this.collapsed) this.listWidth = this.unorderedList?.nativeElement?.scrollWidth;
|
|
41
|
+
|
|
42
|
+
this.collapsed = containerWidth < this.listWidth;
|
|
43
|
+
this.cdr.detectChanges();
|
|
44
|
+
console.log(containerWidth, this.listWidth, this.collapsed)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
//#region overlay
|
|
49
|
+
private overlay = inject(Overlay);
|
|
50
|
+
private overlayRef?: OverlayRef;
|
|
51
|
+
|
|
52
|
+
@ViewChild('menuOverlay') menuOverlay!: TemplateRef<any>; // Template del menú
|
|
53
|
+
@ViewChild('overlayTrigger', { read: ElementRef }) trigger!: ElementRef; // Botó
|
|
54
|
+
|
|
55
|
+
toggleMenu() {
|
|
56
|
+
console.log('toggleMenu');
|
|
57
|
+
this.overlayRef ? this.closeMenu() : this.openMenu();
|
|
58
|
+
}
|
|
59
|
+
private viewContainerRef = inject(ViewContainerRef);
|
|
60
|
+
|
|
61
|
+
openMenu() {
|
|
62
|
+
const positionStrategy = this.overlay
|
|
63
|
+
.position()
|
|
64
|
+
.flexibleConnectedTo(this.trigger)
|
|
65
|
+
.withPositions([
|
|
66
|
+
{
|
|
67
|
+
originX: 'start',
|
|
68
|
+
originY: 'bottom',
|
|
69
|
+
overlayX: 'start',
|
|
70
|
+
overlayY: 'top'
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
this.overlayRef = this.overlay.create({
|
|
75
|
+
positionStrategy,
|
|
76
|
+
hasBackdrop: true,
|
|
77
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
78
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
this.overlayRef.backdropClick().subscribe(() => this.closeMenu());
|
|
82
|
+
|
|
83
|
+
const portal = new TemplatePortal(this.menuOverlay, this.viewContainerRef); // ✅ SI
|
|
84
|
+
this.overlayRef.attach(portal);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
closeMenu() {
|
|
88
|
+
this.overlayRef?.dispose();
|
|
89
|
+
this.overlayRef = undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
action(value: string) {
|
|
93
|
+
console.log(value);
|
|
94
|
+
this.closeMenu();
|
|
95
|
+
}
|
|
96
|
+
//#endregion overlay
|
|
97
|
+
|
|
98
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MenuComponent } from './menu.component';
|
|
4
|
+
|
|
5
|
+
describe('MenuComponent', () => {
|
|
6
|
+
let component: MenuComponent;
|
|
7
|
+
let fixture: ComponentFixture<MenuComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [MenuComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(MenuComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
width: 100%
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
#nav-container {
|
|
6
|
+
height: 0;
|
|
7
|
+
position: sticky;
|
|
8
|
+
top: 0;
|
|
9
|
+
will-change: transform, opacity;
|
|
10
|
+
|
|
11
|
+
nav {
|
|
12
|
+
will-change: transform, opacity;
|
|
13
|
+
position: relative;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
will-change: transform;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-flow: column;
|
|
18
|
+
justify-content: end;
|
|
19
|
+
align-items: center;
|
|
20
|
+
border-bottom: 1px solid grey;
|
|
21
|
+
|
|
22
|
+
#nav-content {
|
|
23
|
+
will-change: transform, opacity;
|
|
24
|
+
min-height: fit-content;
|
|
25
|
+
display: flex;
|
|
26
|
+
width: 100%;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
flex: 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.nav_sticky--onScroll {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div id="nav-container" style="z-index: 1">
|
|
2
|
+
<nav #nav [style.height]="navHeight" [style.minHeight]="sticky ? 'fit-content' : 0 "
|
|
3
|
+
[ngClass]="`nav_sticky--` + sticky">
|
|
4
|
+
<div #navContent id="nav-content">
|
|
5
|
+
<ng-content></ng-content>
|
|
6
|
+
</div>
|
|
7
|
+
</nav>
|
|
8
|
+
</div>
|
|
9
|
+
<div #navFiller id="nav-filler" [style.height]="navHeight">
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NavbarComponent } from './navbar.component';
|
|
4
|
+
|
|
5
|
+
describe('Navbar', () => {
|
|
6
|
+
let component: NavbarComponent;
|
|
7
|
+
let fixture: ComponentFixture<NavbarComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [NavbarComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(NavbarComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import { Component, ElementRef, HostListener, Input, ViewChild } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ard-navbar',
|
|
6
|
+
imports: [NgClass],
|
|
7
|
+
templateUrl: './navbar.component.html',
|
|
8
|
+
styleUrl: './navbar.component.css',
|
|
9
|
+
standalone: true,
|
|
10
|
+
})
|
|
11
|
+
export class NavbarComponent {
|
|
12
|
+
@ViewChild('nav') nav!: ElementRef<HTMLElement>;
|
|
13
|
+
@ViewChild('navFiller') navFiller!: ElementRef<HTMLElement>;
|
|
14
|
+
@ViewChild('navContent') navContent!: ElementRef<HTMLElement>;
|
|
15
|
+
|
|
16
|
+
@Input() onScrollCallback?: (ratio: number) => void;
|
|
17
|
+
@Input() type: 'hero' | 'regular' = 'regular'
|
|
18
|
+
@Input() sticky: boolean | 'onScrollUp' = true;
|
|
19
|
+
@Input() navHeight: CSSStyleDeclaration["height"] = '100vhh'
|
|
20
|
+
|
|
21
|
+
private lastScrollY: number = 0;
|
|
22
|
+
private initialNavHeight!: number;
|
|
23
|
+
|
|
24
|
+
ngAfterViewInit() {
|
|
25
|
+
this.initialNavHeight = this.navFiller.nativeElement.offsetHeight
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@HostListener('window:scroll', [])
|
|
29
|
+
onScroll() {
|
|
30
|
+
|
|
31
|
+
if (this.type == 'hero') this.nav!.nativeElement.style.height = `calc(${this.navHeight} - ${window.scrollY}px)`;
|
|
32
|
+
|
|
33
|
+
if (this.sticky == 'onScrollUp') {
|
|
34
|
+
this.nav.nativeElement.style.minHeight = window.scrollY < this.lastScrollY
|
|
35
|
+
? this.navContent.nativeElement.clientHeight + 'px'
|
|
36
|
+
: '0px';
|
|
37
|
+
this.lastScrollY = window.scrollY
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let navScrollRatio = window.scrollY / (this.initialNavHeight - 100); //100: alçada temptativa del navbar
|
|
41
|
+
navScrollRatio > 1 - this.nav.nativeElement.offsetHeight ? this.nav.nativeElement.style.transition = 'min-height 0.3s ease' : this.nav.nativeElement.style.transition = 'min-height 0s ease';
|
|
42
|
+
|
|
43
|
+
if (this.onScrollCallback) this.onScrollCallback(navScrollRatio);
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<header class="page-header" [ngStyle]="{
|
|
2
|
+
'background': headerBackground
|
|
3
|
+
? `linear-gradient(color-mix(in srgb, var(--color-bg) 40%, transparent), color-mix(in srgb, var(--color-bg) 40%, transparent)),
|
|
4
|
+
url('${headerBackground}') center/cover no-repeat`
|
|
5
|
+
: 'none'
|
|
6
|
+
}" style="position: relative">
|
|
7
|
+
<div class="layout_max-width">
|
|
8
|
+
<h1>
|
|
9
|
+
{{title}}
|
|
10
|
+
</h1>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="custom-shape-divider-top-1770151990" style="position: absolute; bottom: 0; height: 25px; width: 100%">
|
|
13
|
+
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"
|
|
14
|
+
style="height: 40px; width: 100%">
|
|
15
|
+
<path
|
|
16
|
+
d="M985.66,92.83C906.67,72,823.78,31,743.84,14.19c-82.26-17.34-168.06-16.33-250.45.39-57.84,11.73-114,31.07-172,41.86A600.21,600.21,0,0,1,0,27.35V120H1200V95.8C1132.19,118.92,1055.71,111.31,985.66,92.83Z"
|
|
17
|
+
style="fill: var(--color-bg)"></path>
|
|
18
|
+
</svg>
|
|
19
|
+
</div>
|
|
20
|
+
</header>
|
|
21
|
+
|
|
22
|
+
<main class="page-main">
|
|
23
|
+
<div class="layout_max-width">
|
|
24
|
+
<ng-content></ng-content>
|
|
25
|
+
</div>
|
|
26
|
+
</main>
|
|
27
|
+
|
|
28
|
+
<section class="page-sections">
|
|
29
|
+
<div class="layout_max-width">
|
|
30
|
+
<ng-content select="[sections]"></ng-content>
|
|
31
|
+
</div>
|
|
32
|
+
</section>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PageLayoutComponent } from './page-layout.component';
|
|
4
|
+
|
|
5
|
+
describe('PageLayoutComponent', () => {
|
|
6
|
+
let component: PageLayoutComponent;
|
|
7
|
+
let fixture: ComponentFixture<PageLayoutComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [PageLayoutComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(PageLayoutComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgStyle } from '@angular/common';
|
|
2
|
+
import { Component, Input, } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ard-page-layout',
|
|
6
|
+
templateUrl: './page-layout.component.html',
|
|
7
|
+
styleUrls: ['./page-layout.component.css'],
|
|
8
|
+
imports: [NgStyle,]
|
|
9
|
+
})
|
|
10
|
+
export class PageLayoutComponent {
|
|
11
|
+
@Input() headerBackground?: string = '';
|
|
12
|
+
@Input() title?: string = 'Lorem ipsum'
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div style="position: sticky; top:0; height: 0; z-index: 0;">
|
|
2
|
+
<div #content
|
|
3
|
+
style="background: gray; display: flex; justify-content: center; align-items: center;overflow: hidden;">
|
|
4
|
+
<ng-content></ng-content>
|
|
5
|
+
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
<div style="position: relative; height: 100vh; pointer-events: none;" #container>
|
|
9
|
+
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ScrollReactiveSectionComponent } from './scroll-reactive-section.component';
|
|
4
|
+
|
|
5
|
+
describe('ScrollReactiveSectionComponent', () => {
|
|
6
|
+
let component: ScrollReactiveSectionComponent;
|
|
7
|
+
let fixture: ComponentFixture<ScrollReactiveSectionComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ScrollReactiveSectionComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ScrollReactiveSectionComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
ElementRef,
|
|
4
|
+
ViewChild,
|
|
5
|
+
AfterViewInit,
|
|
6
|
+
HostListener
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'ard-scroll-reactive-section',
|
|
11
|
+
standalone: true,
|
|
12
|
+
templateUrl: './scroll-reactive-section.component.html',
|
|
13
|
+
})
|
|
14
|
+
export class ScrollReactiveSectionComponent implements AfterViewInit {
|
|
15
|
+
@ViewChild('container') container!: ElementRef<HTMLElement>;
|
|
16
|
+
@ViewChild('content') content!: ElementRef<HTMLElement>;
|
|
17
|
+
|
|
18
|
+
ngAfterViewInit() {
|
|
19
|
+
this.update();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@HostListener('window:scroll')
|
|
23
|
+
@HostListener('window:resize')
|
|
24
|
+
update() {
|
|
25
|
+
const containerEl = this.container.nativeElement;
|
|
26
|
+
const contentEl = this.content.nativeElement;
|
|
27
|
+
|
|
28
|
+
const rect = containerEl.getBoundingClientRect();
|
|
29
|
+
const viewportHeight = window.innerHeight;
|
|
30
|
+
|
|
31
|
+
const visibleTop = Math.max(rect.top, 0);
|
|
32
|
+
const visibleBottom = Math.min(rect.bottom, viewportHeight);
|
|
33
|
+
const visibleHeight = Math.max(0, visibleBottom - visibleTop);
|
|
34
|
+
|
|
35
|
+
const maxHeight = containerEl.offsetHeight;
|
|
36
|
+
const height = Math.min(visibleHeight, maxHeight);
|
|
37
|
+
|
|
38
|
+
contentEl.style.height = `${height}px`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<section class="layout_max-width">
|
|
2
|
+
<h2>Secció</h2>
|
|
3
|
+
<div style="display: flex;">
|
|
4
|
+
<!-- <app-bottle [color]="'#5b8940'"></app-bottle> -->
|
|
5
|
+
<!-- <app-bottle [color]="'#b4862a'"></app-bottle>
|
|
6
|
+
<app-bottle [color]="'#121e10'"></app-bottle>
|
|
7
|
+
<app-bottle [wineColor]="'#ffffff'"></app-bottle> -->
|
|
8
|
+
<!-- <app-bottle [color]="'#868132'" [wineColor]="'#e2d744'"></app-bottle> -->
|
|
9
|
+
</div>
|
|
10
|
+
</section>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { SectionComponent } from './section.component';
|
|
4
|
+
|
|
5
|
+
describe('Section', () => {
|
|
6
|
+
let component: SectionComponent;
|
|
7
|
+
let fixture: ComponentFixture<SectionComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [SectionComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(SectionComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Injectable } from "@angular/core";
|
|
2
|
+
|
|
3
|
+
@Injectable({ providedIn: 'root' })
|
|
4
|
+
export class ThemeService {
|
|
5
|
+
|
|
6
|
+
ngOnInit() {
|
|
7
|
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
8
|
+
document.body.classList.toggle('dark', prefersDark);
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
toggle() {
|
|
12
|
+
document.body.classList.toggle('dark');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setDark() {
|
|
16
|
+
document.body.classList.add('dark');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
setLight() {
|
|
20
|
+
document.body.classList.remove('dark');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of @ardev/components
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * from './lib/components/bottle/bottle.component';
|
|
6
|
+
export * from './lib/components/caroussel/caroussel.component';
|
|
7
|
+
export * from './lib/components/cronogram/cronogram.component';
|
|
8
|
+
export * from './lib/layouts/menu/menu.component';
|
|
9
|
+
export * from './lib/layouts/navbar/navbar.component';
|
|
10
|
+
export * from './lib/layouts/page-layout/page-layout.component';
|
|
11
|
+
export * from './lib/layouts/scroll-reactive-section/scroll-reactive-section.component'; // probablement esborrar
|
|
12
|
+
export * from './lib/layouts/section/section.component';
|
|
13
|
+
export * from './lib/components/stack-caroussel/stack-caroussel'
|
|
14
|
+
export * from './lib/theme.service'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "../../../tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "../../../../out-tsc/lib",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"types": []
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"src/**/*.ts"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"**/*.spec.ts"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "./tsconfig.lib.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"declarationMap": false
|
|
7
|
+
},
|
|
8
|
+
"angularCompilerOptions": {
|
|
9
|
+
"compilationMode": "partial"
|
|
10
|
+
}
|
|
11
|
+
}
|