Skip to content

Commit

Permalink
chore: fix examples and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin committed Feb 5, 2024
1 parent 2bc60e0 commit 3a69fdf
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Directive, ElementRef, Inject, Input} from '@angular/core';
import {Directive, ElementRef, inject, Input} from '@angular/core';
import {tuiGetActualTarget} from '@taiga-ui/cdk';

@Directive({
Expand All @@ -9,23 +9,17 @@ import {tuiGetActualTarget} from '@taiga-ui/cdk';
},
})
export class TuiSwipeActionsAutoCloseDirective {
private readonly el: HTMLElement = inject(ElementRef).nativeElement;

@Input()
autoClose = true;

constructor(@Inject(ElementRef) private readonly el: ElementRef<HTMLElement>) {}

onPointer(event: PointerEvent): void {
const target = tuiGetActualTarget(event);

if (this.autoClose && !this.el.nativeElement.contains(target)) {
this.close();
if (this.autoClose && !this.el.contains(tuiGetActualTarget(event))) {
this.el.scrollTo({
left: 0,
behavior: 'smooth',
});
}
}

private close(): void {
this.el.nativeElement.scrollTo({
left: 0,
behavior: 'smooth',
});
}
}
4 changes: 1 addition & 3 deletions projects/core/styles/mixins/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,7 @@

&::-webkit-scrollbar,
&::-webkit-scrollbar-thumb {
background: transparent;
width: 0;
height: 0;
display: none;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<tui-swipe-actions>
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
</div>

Expand All @@ -34,16 +36,18 @@
</tui-swipe-actions>

<tui-swipe-actions>
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconGift"
></tui-avatar>
<div tuiTitle>
<strong>{{ 23000 | tuiAmount: 'EUR' | async }}</strong>
<div tuiSubtitle>Goal</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconGift"
></tui-avatar>
<div tuiTitle>
<strong>{{ 23000 | tuiAmount: 'EUR' | async }}</strong>
<div tuiSubtitle>Goal</div>
</div>
</div>

Expand All @@ -59,16 +63,18 @@
[style.--tui-action-gap]="16"
[style.--tui-item-size]="32"
>
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconBriefcase"
></tui-avatar>
<div tuiTitle>
<strong>{{ 5000 | tuiAmount: 'EUR' | async }}</strong>
<div tuiSubtitle>Vacations</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconBriefcase"
></tui-avatar>
<div tuiTitle>
<strong>{{ 5000 | tuiAmount: 'EUR' | async }}</strong>
<div tuiSubtitle>Vacations</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.blur {
background-image: url('/assets/images/restaurant-2.jpg');
border-radius: 1rem;
padding: 1.25rem;
display: flex;
justify-content: space-between;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<tui-swipe-actions [autoClose]="true">
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
</div>

Expand All @@ -34,16 +36,18 @@
</tui-swipe-actions>

<tui-swipe-actions [autoClose]="true">
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconGift"
></tui-avatar>
<div tuiTitle>
<strong>{{ 23000 | tuiAmount: 'EUR' | async }}</strong>
<div tuiSubtitle>Goal</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconGift"
></tui-avatar>
<div tuiTitle>
<strong>{{ 23000 | tuiAmount: 'EUR' | async }}</strong>
<div tuiSubtitle>Goal</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<tui-swipe-actions>
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<tui-swipe-actions>
<div tuiSurface="elevated">
<div tuiCell>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
<div
tuiCardLarge
tuiCell
tuiSurface="elevated"
>
<tui-avatar
appearance="primary"
src="tuiIconDollarSignLarge"
></tui-avatar>
<div tuiTitle>
<strong>{{ 10000 | tuiAmount: 'USD' | async }}</strong>
<div tuiSubtitle>Dollar account</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
TuiAmountPipeModule,
TuiAvatarModule,
TuiButtonModule,
TuiCardModule,
TuiCellModule,
TuiCheckboxModule,
TuiIconModule,
Expand All @@ -39,6 +40,7 @@ import {ExampleTuiSwipeActionsComponent} from './swipe-actions.component';
TuiAddonDocModule,
TuiAvatarModule,
TuiCellModule,
TuiCardModule,
TuiSurfaceModule,
TuiSwipeActionsComponent,
TuiSwipeActionsAutoCloseDirective,
Expand Down
2 changes: 0 additions & 2 deletions projects/kit/components/carousel/carousel.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
display: flex;
overflow: auto;
overscroll-behavior-x: none;
padding-bottom: 2rem;
margin-bottom: -2rem;

&:before,
&:after {
Expand Down

0 comments on commit 3a69fdf

Please sign in to comment.