[SM-303] feat: add fadeIn animation to bit-dialog (#4309)

This commit is contained in:
Will Martin 2023-01-11 10:47:43 -05:00 committed by GitHub
parent 4be2989fec
commit 794f1193db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import { style, animate, trigger, transition, group } from "@angular/animations";
export const fadeIn = trigger("fadeIn", [
transition(":enter", [
style({ opacity: 0, transform: "translateY(-50px)" }),
group([
animate("0.15s linear", style({ opacity: 1 })),
animate("0.3s ease-out", style({ transform: "none" })),
]),
]),
]);

View File

@ -1,6 +1,7 @@
<div
[ngClass]="width"
class="tw-my-4 tw-flex tw-max-h-screen tw-flex-col tw-overflow-hidden tw-rounded tw-border tw-border-solid tw-border-secondary-300 tw-bg-text-contrast tw-text-main"
@fadeIn
>
<div
class="tw-flex tw-items-center tw-gap-4 tw-border-0 tw-border-b tw-border-solid tw-border-secondary-300 tw-p-4"

View File

@ -1,9 +1,12 @@
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { Component, Input } from "@angular/core";
import { fadeIn } from "../animations";
@Component({
selector: "bit-dialog",
templateUrl: "./dialog.component.html",
animations: [fadeIn],
})
export class DialogComponent {
@Input() dialogSize: "small" | "default" | "large" = "default";

View File

@ -1,5 +1,6 @@
<div
class="tw-my-4 tw-flex tw-max-h-screen tw-w-96 tw-max-w-90vw tw-flex-col tw-overflow-hidden tw-rounded tw-border tw-border-solid tw-border-secondary-300 tw-bg-text-contrast tw-text-main"
@fadeIn
>
<div class="tw-flex tw-flex-col tw-items-center tw-gap-2 tw-px-4 tw-pt-4 tw-text-center">
<ng-content *ngIf="hasIcon; else elseBlock" select="[bit-dialog-icon]"></ng-content>

View File

@ -1,11 +1,14 @@
import { Component, ContentChild, Directive } from "@angular/core";
import { fadeIn } from "../animations";
@Directive({ selector: "[bit-dialog-icon]" })
export class IconDirective {}
@Component({
selector: "bit-simple-dialog",
templateUrl: "./simple-dialog.component.html",
animations: [fadeIn],
})
export class SimpleDialogComponent {
@ContentChild(IconDirective) icon!: IconDirective;