Skip to content

Commit

Permalink
Merge pull request #2606 from abpframework/feature/toast-component
Browse files Browse the repository at this point in the history
feat(theme-shared): new toast and confirmation components
  • Loading branch information
mehmet-erim authored Jan 10, 2020
2 parents e15ab83 + 1a99d4d commit 6f100be
Show file tree
Hide file tree
Showing 28 changed files with 727 additions and 367 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { eLayoutType } from '@abp/ng.core';
template: `
<router-outlet></router-outlet>
<abp-confirmation></abp-confirmation>
<abp-toast></abp-toast>
<abp-toast-container right="30px" bottom="30px"></abp-toast-container>
`,
})
export class AccountLayoutComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
<ng-template #defaultLink let-route>
<li class="nav-item" *abpPermission="route.requiredPolicy">
<a class="nav-link" [routerLink]="[route.url]"
><i *ngIf="route.iconClass" [ngClass]="route.iconClass"></i> {{ route.name | abpLocalization }}</a
><i *ngIf="route.iconClass" [ngClass]="route.iconClass"></i>
{{ route.name | abpLocalization }}</a
>
</li>
</ng-template>
Expand All @@ -47,7 +48,9 @@
class="nav-item dropdown"
display="static"
(click)="
navbarRootDropdown.expand ? (navbarRootDropdown.expand = false) : (navbarRootDropdown.expand = true)
navbarRootDropdown.expand
? (navbarRootDropdown.expand = false)
: (navbarRootDropdown.expand = true)
"
>
<a
Expand All @@ -57,7 +60,8 @@
aria-expanded="false"
href="javascript:void(0)"
>
<i *ngIf="route.iconClass" [ngClass]="route.iconClass"></i> {{ route.name | abpLocalization }}
<i *ngIf="route.iconClass" [ngClass]="route.iconClass"></i>
{{ route.name | abpLocalization }}
</a>
<div
#routeContainer
Expand Down Expand Up @@ -146,12 +150,15 @@
</div>
</nav>

<div [@slideFromBottom]="outlet && outlet.activatedRoute && outlet.activatedRoute.routeConfig.path" class="container">
<div
[@slideFromBottom]="outlet && outlet.activatedRoute && outlet.activatedRoute.routeConfig.path"
class="container"
>
<router-outlet #outlet="outlet"></router-outlet>
</div>

<abp-confirmation></abp-confirmation>
<abp-toast></abp-toast>
<abp-toast-container right="30px" bottom="30px"></abp-toast-container>

<ng-template #appName>
{{ appInfo.name }}
Expand Down Expand Up @@ -213,12 +220,12 @@
[class.d-block]="smallScreen"
[class.abp-mh-25]="smallScreen && currentUserDropdown.isOpen()"
>
<a class="dropdown-item" routerLink="/account/manage-profile"><i class="fa fa-cog mr-1"></i>{{
'AbpAccount::ManageYourProfile' | abpLocalization
}}</a>
<a class="dropdown-item" href="javascript:void(0)" (click)="logout()"><i class="fa fa-power-off mr-1"></i>{{
'AbpUi::Logout' | abpLocalization
}}</a>
<a class="dropdown-item" routerLink="/account/manage-profile"
><i class="fa fa-cog mr-1"></i>{{ 'AbpAccount::ManageYourProfile' | abpLocalization }}</a
>
<a class="dropdown-item" href="javascript:void(0)" (click)="logout()"
><i class="fa fa-power-off mr-1"></i>{{ 'AbpUi::Logout' | abpLocalization }}</a
>
</div>
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { eLayoutType } from '@abp/ng.core';
template: `
<router-outlet></router-outlet>
<abp-confirmation></abp-confirmation>
<abp-toast></abp-toast>
<abp-toast-container right="30px" bottom="30px"></abp-toast-container>
`,
})
export class EmptyLayoutComponent {
Expand Down
6 changes: 0 additions & 6 deletions npm/ng-packs/packages/theme-basic/src/lib/constants/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ export default `
.container > .card {
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}
.abp-confirm .abp-confirm-footer {
background-color: #f4f4f7 !important;
}
.abp-confirm .ui-toast-message-content {
background-color: #fff !important;
}
@media screen and (min-width: 768px) {
.navbar .dropdown:hover > .dropdown-menu {
Expand Down
56 changes: 0 additions & 56 deletions npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './collapse.animations';
export * from './fade.animations';
export * from './modal.animations';
export * from './slide.animations';
export * from './toast.animations';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { animate, query, style, transition, trigger } from '@angular/animations';

export const toastInOut = trigger('toastInOut', [
transition('* <=> *', [
query(
':enter',
[
style({ opacity: 0, transform: 'translateY(20px)' }),
animate('350ms ease', style({ opacity: 1, transform: 'translateY(0)' })),
],
{ optional: true },
),
query(':leave', animate('450ms ease', style({ opacity: 0 })), {
optional: true,
}),
]),
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div class="confirmation show" *ngIf="visible">
<div class="confirmation-backdrop"></div>
<div class="confirmation-dialog">
<div class="icon-container" [ngClass]="data.severity" *ngIf="data.severity">
<i class="fa icon" [ngClass]="iconClass"></i>
</div>
<div class="content">
<h1 class="title" *ngIf="data.title">
{{ data.title | abpLocalization: data.options?.titleLocalizationParams }}
</h1>
<p class="message" *ngIf="data.message">
{{ data.message | abpLocalization: data.options?.messageLocalizationParams }}
</p>
</div>
<div class="footer">
<button
id="cancel"
class="confirmation-button confirmation-button-reject"
*ngIf="!data?.options?.hideCancelBtn"
(click)="close(reject)"
>
{{ data.options?.cancelText || 'AbpUi::Cancel' | abpLocalization }}
</button>
<button
id="confirm"
class="confirmation-button confirmation-button-approve"
*ngIf="!data?.options?.hideYesBtn"
(click)="close(confirm)"
>
{{ data.options?.yesText || 'AbpUi::Yes' | abpLocalization }}
</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.confirmation {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: none;
place-items: center;
z-index: 1060;
&.show {
display: grid;
}
.confirmation-backdrop {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(#000, 0.7);
z-index: 1061 !important;
}
.confirmation-dialog {
display: flex;
flex-direction: column;
margin: 20px auto;
padding: 0;
border: none;
border-radius: 10px;
min-width: 450px;
min-height: 300px;
background-color: #fff;
box-shadow: 0 0 10px -5px rgba(#000, 0.5);
z-index: 1062 !important;
.icon-container {
display: flex;
align-items: center;
justify-content: center;
margin: 0 0 10px 0;
padding: 20px;
.icon {
width: 100px;
height: 100px;
stroke-width: 1;
fill: #fff;
font-size: 80px;
text-align: center;
}
&.neutral .icon {
}
&.info .icon {
stroke: #2f96b4;
color: #2f96b4;
}
&.success .icon {
stroke: #51a351;
color: #51a351;
}
&.warning .icon {
stroke: #f89406;
color: #f89406;
}
&.error .icon {
stroke: #bd362f;
color: #bd362f;
}
}
.content {
flex-grow: 1;
display: block;
.title {
display: block;
margin: 0;
padding: 0;
font-size: 27px;
font-weight: 600;
text-align: center;
}
.message {
display: block;
margin: 10px auto;
padding: 0;
color: #777;
font-size: 16px;
font-weight: 400;
text-align: center;
}
}
.footer {
display: flex;
align-items: center;
justify-content: flex-end;
margin: 10px 0 0 0;
padding: 20px;
width: 100%;
.confirmation-button {
display: inline-block;
margin: 0px 5px;
padding: 10px 20px;
border: none;
border-radius: 6px;
color: #777;
font-size: 14px;
font-weight: 600;
background-color: #eee;
&:hover {
background-color: darken(#eee, 5);
}
&-reject {
}
&-approve {
background-color: #2f96b4;
color: #fff;
&:hover {
background-color: darken(#2f96b4, 5);
}
}
}
}
}
}
Loading

0 comments on commit 6f100be

Please sign in to comment.