Skip to content

Commit

Permalink
feat(experimental): add tuiButtonGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Feb 6, 2024
1 parent d4bab1a commit ea8f4c1
Show file tree
Hide file tree
Showing 24 changed files with 533 additions and 0 deletions.
9 changes: 9 additions & 0 deletions projects/demo/src/modules/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ export const ROUTES: Routes = [
title: 'ButtonClose',
},
},
{
path: 'experimental/button-group',
loadChildren: async () =>
(await import('../experimental/button-group/button-group.module'))
.ExampleTuiButtonGroupModule,
data: {
title: 'ButtonGroup',
},
},
{
path: 'experimental/cell',
loadChildren: async () =>
Expand Down
6 changes: 6 additions & 0 deletions projects/demo/src/modules/app/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,12 @@ export const pages: TuiDocPages = [
keywords: 'кнопка, button, close, закрыть',
route: '/experimental/button-close',
},
{
section: 'Experimental',
title: 'ButtonGroup',
keywords: 'кнопка, button, group, группа',
route: '/experimental/button-group',
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';

@Component({
selector: 'example-button-group-card',
templateUrl: './button-group.template.html',
changeDetection,
})
export class ExampleTuiButtonGroupComponent {
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

readonly example1: TuiDocExample = {
HTML: import('./examples/1/index.html?raw'),
};

readonly example2: TuiDocExample = {
HTML: import('./examples/2/index.html?raw'),
};

readonly example3: TuiDocExample = {
HTML: import('./examples/3/index.html?raw'),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {tuiGetDocModules} from '@taiga-ui/addon-doc';
import {TuiNotificationModule} from '@taiga-ui/core';
import {
TuiBadgedContentModule,
TuiButtonGroupModule,
TuiButtonModule,
TuiButtonVerticalModule,
TuiSurfaceModule,
} from '@taiga-ui/experimental';

import {ExampleTuiButtonGroupComponent} from './button-group.component';
import {TuiButtonGroupExample1} from './examples/1';
import {TuiButtonGroupExample2} from './examples/2';
import {TuiButtonGroupExample3} from './examples/3';

@NgModule({
imports: [
CommonModule,
TuiNotificationModule,
TuiButtonModule,
tuiGetDocModules(ExampleTuiButtonGroupComponent),
TuiButtonVerticalModule,
TuiSurfaceModule,
TuiButtonGroupModule,
TuiBadgedContentModule,
],
declarations: [
ExampleTuiButtonGroupComponent,
TuiButtonGroupExample1,
TuiButtonGroupExample2,
TuiButtonGroupExample3,
],
exports: [ExampleTuiButtonGroupComponent],
})
export class ExampleTuiButtonGroupModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<tui-doc-page
header="ButtonGroup"
package="EXPERIMENTAL"
type="directives"
>
<ng-template pageTab>
<tui-notification status="warning">
This code is
<strong>experimental</strong>
and is a subject to change. Expect final solution to be shipped in the next major version
</tui-notification>

<tui-doc-example
id="elevated"
heading="Elevated"
[content]="example1"
>
<tui-button-group-example-1></tui-button-group-example-1>
</tui-doc-example>

<tui-doc-example
id="flat"
heading="Flat"
[content]="example2"
>
<tui-button-group-example-2></tui-button-group-example-2>
</tui-doc-example>

<tui-doc-example
id="dark"
heading="Dark"
[content]="example3"
>
<tui-button-group-example-3></tui-button-group-example-3>
</tui-doc-example>
</ng-template>

<ng-template pageTab="Setup">
<ol class="b-demo-steps">
<li>
<p>Import module:</p>

<tui-doc-code
filename="myComponent.module.ts"
[code]="exampleModule"
></tui-doc-code>
</li>

<li>
<p>Add to the template:</p>

<tui-doc-code
filename="myComponent.template.html"
[code]="exampleHtml"
></tui-doc-code>
</li>
</ol>
</ng-template>
</tui-doc-page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<div
tuiButtonGroup
tuiSurface="elevated"
>
<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
tuiButtonVertical
>
Create a payment
</button>

<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
tuiButtonVertical
>
Pay the bill
</button>

<button
appearance="link"
iconLeft="tuiIconStarLarge"
tuiButton
tuiButtonVertical
>
Remove from favorites
</button>
</div>

<div
tuiButtonGroup
tuiSurface="elevated"
>
<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
tuiButtonVertical
>
Top up
</button>

<button
appearance="link"
iconLeft="tuiIconArrowRightCircleLarge"
tuiButton
tuiButtonVertical
>
Take out
</button>
</div>

<div
tuiSurface
class="shadow"
>
<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
>
To repay
</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:host {
display: flex;
flex-direction: column;
gap: 1rem;
}

.shadow {
box-shadow: var(--tui-shadow);
border-radius: 1rem;

[tuiButton] {
font-size: 0.8125rem;
width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';

@Component({
selector: 'tui-button-group-example-1',
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
export class TuiButtonGroupExample1 {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<div
tuiButtonGroup
tuiSurface="flat"
>
<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
tuiButtonVertical
>
Create a payment
</button>

<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
tuiButtonVertical
>
Pay the bill
</button>

<button
appearance="link"
iconLeft="tuiIconStarLarge"
tuiButton
tuiButtonVertical
>
Remove from favorites
</button>
</div>

<div
tuiButtonGroup
tuiSurface="flat"
>
<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
tuiButtonVertical
>
Top up
</button>

<button
appearance="link"
iconLeft="tuiIconArrowRightCircleLarge"
tuiButton
tuiButtonVertical
>
Take out
</button>
</div>

<div
tuiSurface
class="shadow"
>
<button
appearance="link"
iconLeft="tuiIconPlusCircleLarge"
tuiButton
>
To repay
</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:host {
display: flex;
flex-direction: column;
gap: 1rem;
}

.shadow {
background: var(--tui-clear);
border-radius: 1rem;

[tuiButton] {
font-size: 0.8125rem;
width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';

@Component({
selector: 'tui-button-group-example-2',
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
export class TuiButtonGroupExample2 {}
Loading

0 comments on commit ea8f4c1

Please sign in to comment.