Skip to content

Commit

Permalink
chore(docs): #9644 added top position example for ActionBar
Browse files Browse the repository at this point in the history
  • Loading branch information
40oleg committed Oct 31, 2024
1 parent 01967d9 commit 762d2ca
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 6 deletions.
21 changes: 16 additions & 5 deletions projects/demo-playwright/tests/kit/action-bar/action-bar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {DemoRoute} from '@demo/routes';
import {tuiGoto} from '@demo-playwright/utils';
import {expect, test} from '@playwright/test';
import { DemoRoute } from '@demo/routes';
import { tuiGoto } from '@demo-playwright/utils';
import { expect, test } from '@playwright/test';

test.describe('ActionBar', () => {
test.use({
viewport: {width: 1000, height: 720},
viewport: { width: 1000, height: 720 },
});

test('works', async ({page}) => {
test('works', async ({ page }) => {
await tuiGoto(page, DemoRoute.ActionBar);
const example = page.locator('#size--m');
const showActionBarButton = example.locator('label').first();
Expand All @@ -17,4 +17,15 @@ test.describe('ActionBar', () => {

await expect(actionBarExample).toHaveScreenshot('01-actions-bar.png');
});

test('should show on top', async ({ page }) => {
await tuiGoto(page, DemoRoute.ActionBar);
const example = page.locator('#top-position');
const showActionBarButton = example.locator('label').first();

await showActionBarButton.click();
const actionBarExample = page.locator('tui-action-bar');

await expect(actionBarExample).toHaveScreenshot('02-actions-bar.png');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<button
size="m"
tuiButton
type="button"
(click)="open.set(true)"
>
Show TableBar on top
</button>

<tui-action-bar
*tuiActionBar="open()"
size="s"
>
<span [style.width.%]="isMobile() ? 100 : null">Table bar opened</span>

<button
appearance="glass"
iconStart="@tui.trash"
tuiButton
type="button"
(click)="open.set(false)"
>
Remove
</button>
<button
iconStart="@tui.x"
tuiIconButton
type="button"
[appearance]="isMobile() ? 'glass' : 'icon'"
(click)="open.set(false)"
>
Close
</button>
</tui-action-bar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tui-action-bar {
top: 1rem;
bottom: unset !important;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {NgIf} from '@angular/common';
import {Component, inject, signal} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiBreakpointService, TuiButton} from '@taiga-ui/core';
import {TuiActionBar} from '@taiga-ui/kit';
import {map} from 'rxjs';

@Component({
standalone: true,
imports: [NgIf, TuiActionBar, TuiButton],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
export default class Example {
protected open = signal(false);

protected readonly isMobile = toSignal(
inject(TuiBreakpointService).pipe(map((size) => size === 'mobile')),
);
}
2 changes: 1 addition & 1 deletion projects/demo/src/modules/components/action-bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ import {TuiDemo} from '@demo/utils';
changeDetection,
})
export default class Page {
protected readonly examples = ['Size M', 'Size S'];
protected readonly examples = ['Size M', 'Size S', 'Top position'];
}

0 comments on commit 762d2ca

Please sign in to comment.