Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 768359b

Browse files
feat(router-item): fix router items,
add animation to example component
1 parent b904bce commit 768359b

11 files changed

+61
-25
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/core/src/lib/icon/icon.component.scss

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
:host{
1+
:host {
22
display: contents;
3+
--fiv-padding-end: 0;
4+
--fiv-padding-start: 0;
35
}
46

57
ion-icon {
6-
padding: 0;
78
margin: 0;
89
font-size: 1.8em;
910
color: var(--fiv-color-icon);
11+
padding-right: var(--fiv-padding-end);
12+
padding-left: var(--fiv-padding-start);
1013
}
1114

1215
.indicator {

projects/core/src/lib/popover/popover.component.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
}
44

55
.popover-item:hover {
6-
background: rgb(240, 240, 240);
6+
--background: rgb(240, 240, 240);
7+
cursor: pointer;
78
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
<ng-content></ng-content>
1+
<ion-item>
2+
<fiv-icon [name]="icon"></fiv-icon>
3+
<ion-label>{{text}}</ion-label>
4+
</ion-item>
25
<span *ngIf="hasShape()" [ngClass]="getClasses()" class="indicator"></span>
36
<ion-icon *ngIf="!hasShape()" [ngClass]="position" [name]="shape" class="indicator"></ion-icon>

projects/core/src/lib/router-item/router-item.component.scss

+23-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
width: 100%;
55
}
66

7-
:host.active .dot {
7+
:host.active {
8+
--fiv-color-icon: var(--ion-color-primary);
9+
ion-item{
10+
--color: var(--ion-color-primary);
11+
}
12+
}
13+
14+
:host.active .dot {
815
display: block;
916
}
1017

11-
:host.active .line{
18+
:host.active .line {
1219
background-color: var(--fiv-dot-color, var(--ion-color-primary));
1320
display: block;
1421
}
@@ -31,7 +38,7 @@
3138
height: 2px
3239
}
3340

34-
:host.active.bottom .line{
41+
:host.active.bottom .line {
3542
width: calc(100% - 16px);
3643
height: 2px;
3744
left: 8px;
@@ -67,7 +74,6 @@
6774
}
6875

6976
// position
70-
7177
.left {
7278
left: 0;
7379
}
@@ -84,5 +90,17 @@
8490
bottom: 0;
8591
}
8692

87-
.outline {
93+
.outline {}
94+
95+
ion-item {
96+
--border-style: none;
8897
}
98+
99+
fiv-icon {
100+
--fiv-padding-end: 8px;
101+
}
102+
103+
ion-item:hover {
104+
cursor: pointer;
105+
--background: rgb(240, 240, 240);
106+
}

projects/core/src/lib/router-item/router-item.component.ts

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export class RouterItemComponent implements OnInit {
1414

1515
@Input() pageUrl: string;
1616

17+
@Input() icon: string;
18+
19+
@Input() text: string;
20+
1721
/**
1822
* The position of the active state.
1923
* Default value is: `"left"`

src/app/app.component.html

+3-12
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,13 @@
66
<ion-buttons slot="start">
77
<fiv-collapsable-menu-button #mb *fivIf="['desktop']" [menu]="menu"></fiv-collapsable-menu-button>
88
</ion-buttons>
9-
<ion-title>Logo</ion-title>
9+
<ion-title>Fivethree Components</ion-title>
1010
</ion-toolbar>
1111
</ion-header>
1212
<ion-content>
1313
<ion-list>
14-
<fiv-router-item position="right" shape="dot" [matchChildUrl]="false" [pageUrl]="p.url" *ngFor="let p of appPages">
15-
<ion-menu-toggle auto-hide="false">
16-
<fiv-ripple>
17-
<ion-item line="inset">
18-
<ion-icon slot="start" [name]="p.icon"></ion-icon>
19-
<ion-label>
20-
{{p.title}}
21-
</ion-label>
22-
</ion-item>
23-
</fiv-ripple>
24-
</ion-menu-toggle>
14+
<fiv-router-item [icon]="p.icon" [text]="p.title" [matchChildUrl]="false"
15+
[pageUrl]="p.url" *ngFor="let p of appPages">
2516
</fiv-router-item>
2617
</ion-list>
2718
</ion-content>

src/app/app.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ComponentsModule } from 'src/app/components/components.module';
12
import { FivethreeCoreModule } from 'core';
23
import { NgModule } from '@angular/core';
34
import { BrowserModule } from '@angular/platform-browser';
@@ -38,6 +39,7 @@ export function HttpLoaderFactory(http: HttpClient) {
3839
}),
3940
MarkdownModule.forRoot({ loader: HttpClient }),
4041
LottieAnimationViewModule.forRoot(),
42+
ComponentsModule
4143
],
4244
providers: [
4345
StatusBar,

src/app/components/example/example.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ion-card-header>
1313

1414
<ion-card-content>
15-
<div *ngIf="showApi" class="content-container">
15+
<div [@listAnim]="showApi ? 'open' : 'closed'" class="content-container">
1616
<markdown [src]="snippet"></markdown>
1717
</div>
1818
<div class="content-container">

src/app/components/example/example.component.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
import { Component, OnInit, Input } from '@angular/core';
2+
import { trigger, state, style, transition, animate } from '@angular/animations';
23

34
@Component({
45
selector: 'app-example',
56
templateUrl: './example.component.html',
6-
styleUrls: ['./example.component.scss']
7+
styleUrls: ['./example.component.scss'],
8+
animations: [trigger('listAnim', [
9+
state('open', style({ height: '*', opacity: 1 })),
10+
state('closed', style({ height: '0px', opacity: 0 })),
11+
transition('closed => open', [
12+
style({ height: '0px', opacity: 0 }),
13+
animate('220ms ease', style({ height: '*', opacity: 1 }))
14+
]),
15+
transition('open => closed', [
16+
style({ height: '*', opacity: 1 }),
17+
animate('180ms ease', style({ height: '0', opacity: 0 }),
18+
)
19+
])
20+
])]
721
})
822
export class ExampleComponent implements OnInit {
923

src/app/pages/buttons/buttons.page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</ion-item-divider>
1111

1212
<ion-card>
13-
<ion-toolbar>
13+
<ion-toolbar color="primary">
1414
<fiv-buttons [iconsOnly]="iconsOnly" [forceActionsheet]="forceActionsheet" [forcePopover]="forcePopover"
1515
[header]="header" [subHeader]="subHeader" [count]="count" slot="end">
1616
<fiv-button (click)="presentToast('add clicked')" [icon]="'md-add'" [text]="'Add'">

0 commit comments

Comments
 (0)