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

Commit

Permalink
feat(router-item): fix router items,
Browse files Browse the repository at this point in the history
add animation to example component
  • Loading branch information
garygrossgarten committed Dec 12, 2018
1 parent b904bce commit 768359b
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions projects/core/src/lib/icon/icon.component.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
:host{
:host {
display: contents;
--fiv-padding-end: 0;
--fiv-padding-start: 0;
}

ion-icon {
padding: 0;
margin: 0;
font-size: 1.8em;
color: var(--fiv-color-icon);
padding-right: var(--fiv-padding-end);
padding-left: var(--fiv-padding-start);
}

.indicator {
Expand Down
3 changes: 2 additions & 1 deletion projects/core/src/lib/popover/popover.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
}

.popover-item:hover {
background: rgb(240, 240, 240);
--background: rgb(240, 240, 240);
cursor: pointer;
}
5 changes: 4 additions & 1 deletion projects/core/src/lib/router-item/router-item.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<ng-content></ng-content>
<ion-item>
<fiv-icon [name]="icon"></fiv-icon>
<ion-label>{{text}}</ion-label>
</ion-item>
<span *ngIf="hasShape()" [ngClass]="getClasses()" class="indicator"></span>
<ion-icon *ngIf="!hasShape()" [ngClass]="position" [name]="shape" class="indicator"></ion-icon>
28 changes: 23 additions & 5 deletions projects/core/src/lib/router-item/router-item.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
width: 100%;
}

:host.active .dot {
:host.active {
--fiv-color-icon: var(--ion-color-primary);
ion-item{
--color: var(--ion-color-primary);
}
}

:host.active .dot {
display: block;
}

:host.active .line{
:host.active .line {
background-color: var(--fiv-dot-color, var(--ion-color-primary));
display: block;
}
Expand All @@ -31,7 +38,7 @@
height: 2px
}

:host.active.bottom .line{
:host.active.bottom .line {
width: calc(100% - 16px);
height: 2px;
left: 8px;
Expand Down Expand Up @@ -67,7 +74,6 @@
}

// position

.left {
left: 0;
}
Expand All @@ -84,5 +90,17 @@
bottom: 0;
}

.outline {
.outline {}

ion-item {
--border-style: none;
}

fiv-icon {
--fiv-padding-end: 8px;
}

ion-item:hover {
cursor: pointer;
--background: rgb(240, 240, 240);
}
4 changes: 4 additions & 0 deletions projects/core/src/lib/router-item/router-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class RouterItemComponent implements OnInit {

@Input() pageUrl: string;

@Input() icon: string;

@Input() text: string;

/**
* The position of the active state.
* Default value is: `"left"`
Expand Down
15 changes: 3 additions & 12 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@
<ion-buttons slot="start">
<fiv-collapsable-menu-button #mb *fivIf="['desktop']" [menu]="menu"></fiv-collapsable-menu-button>
</ion-buttons>
<ion-title>Logo</ion-title>
<ion-title>Fivethree Components</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<fiv-router-item position="right" shape="dot" [matchChildUrl]="false" [pageUrl]="p.url" *ngFor="let p of appPages">
<ion-menu-toggle auto-hide="false">
<fiv-ripple>
<ion-item line="inset">
<ion-icon slot="start" [name]="p.icon"></ion-icon>
<ion-label>
{{p.title}}
</ion-label>
</ion-item>
</fiv-ripple>
</ion-menu-toggle>
<fiv-router-item [icon]="p.icon" [text]="p.title" [matchChildUrl]="false"
[pageUrl]="p.url" *ngFor="let p of appPages">
</fiv-router-item>
</ion-list>
</ion-content>
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ComponentsModule } from 'src/app/components/components.module';
import { FivethreeCoreModule } from 'core';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
Expand Down Expand Up @@ -38,6 +39,7 @@ export function HttpLoaderFactory(http: HttpClient) {
}),
MarkdownModule.forRoot({ loader: HttpClient }),
LottieAnimationViewModule.forRoot(),
ComponentsModule
],
providers: [
StatusBar,
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/example/example.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ion-card-header>

<ion-card-content>
<div *ngIf="showApi" class="content-container">
<div [@listAnim]="showApi ? 'open' : 'closed'" class="content-container">
<markdown [src]="snippet"></markdown>
</div>
<div class="content-container">
Expand Down
16 changes: 15 additions & 1 deletion src/app/components/example/example.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import { Component, OnInit, Input } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';

@Component({
selector: 'app-example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.scss']
styleUrls: ['./example.component.scss'],
animations: [trigger('listAnim', [
state('open', style({ height: '*', opacity: 1 })),
state('closed', style({ height: '0px', opacity: 0 })),
transition('closed => open', [
style({ height: '0px', opacity: 0 }),
animate('220ms ease', style({ height: '*', opacity: 1 }))
]),
transition('open => closed', [
style({ height: '*', opacity: 1 }),
animate('180ms ease', style({ height: '0', opacity: 0 }),
)
])
])]
})
export class ExampleComponent implements OnInit {

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/buttons/buttons.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ion-item-divider>

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

0 comments on commit 768359b

Please sign in to comment.