-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(experimental):
BlockDetails
add new component
- Loading branch information
1 parent
b049aa3
commit 2503a8d
Showing
20 changed files
with
381 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
projects/demo/src/modules/experimental/block-details/block-details.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc'; | ||
|
||
@Component({ | ||
selector: 'example-block-details', | ||
templateUrl: './block-details.template.html', | ||
changeDetection, | ||
}) | ||
export class ExampleTuiBlockDetailsComponent { | ||
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'), | ||
TypeScript: import('./examples/1/index.ts?raw'), | ||
}; | ||
|
||
readonly example2: TuiDocExample = { | ||
HTML: import('./examples/2/index.html?raw'), | ||
LESS: import('./examples/2/index.less?raw'), | ||
TypeScript: import('./examples/2/index.ts?raw'), | ||
}; | ||
} |
39 changes: 39 additions & 0 deletions
39
projects/demo/src/modules/experimental/block-details/block-details.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {CommonModule} from '@angular/common'; | ||
import {NgModule} from '@angular/core'; | ||
import {RouterModule} from '@angular/router'; | ||
import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; | ||
import {TuiNotificationModule} from '@taiga-ui/core'; | ||
import { | ||
TuiAmountPipeModule, | ||
TuiAvatarModule, | ||
TuiBadgeModule, | ||
TuiBlockDetailsModule, | ||
TuiFadeModule, | ||
TuiTitleModule, | ||
} from '@taiga-ui/experimental'; | ||
|
||
import {ExampleTuiBlockDetailsComponent} from './block-details.component'; | ||
import {TuiBlockDetailsExample1} from './examples/1'; | ||
import {TuiBlockDetailsExample2} from './examples/2'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
TuiAddonDocModule, | ||
TuiAvatarModule, | ||
TuiAmountPipeModule, | ||
TuiBadgeModule, | ||
TuiTitleModule, | ||
TuiBlockDetailsModule, | ||
TuiFadeModule, | ||
TuiNotificationModule, | ||
RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBlockDetailsComponent)), | ||
], | ||
declarations: [ | ||
ExampleTuiBlockDetailsComponent, | ||
TuiBlockDetailsExample1, | ||
TuiBlockDetailsExample2, | ||
], | ||
exports: [ExampleTuiBlockDetailsComponent], | ||
}) | ||
export class ExampleTuiBlockDetailsModule {} |
53 changes: 53 additions & 0 deletions
53
projects/demo/src/modules/experimental/block-details/block-details.template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<tui-doc-page | ||
header="BlockDetails" | ||
package="EXPERIMENTAL" | ||
type="components" | ||
> | ||
<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> | ||
|
||
<p>Layout component for describing details. For example, transaction details</p> | ||
|
||
<tui-doc-example | ||
id="full" | ||
heading="Full" | ||
[content]="example1" | ||
> | ||
<tui-block-details-example-1></tui-block-details-example-1> | ||
</tui-doc-example> | ||
|
||
<tui-doc-example | ||
id="customization" | ||
heading="Customization" | ||
[content]="example2" | ||
> | ||
<tui-block-details-example-2></tui-block-details-example-2> | ||
</tui-doc-example> | ||
</ng-template> | ||
|
||
<ng-template pageTab="Setup"> | ||
<ol class="b-demo-steps"> | ||
<li> | ||
<p>Import module:</p> | ||
|
||
<tui-doc-code | ||
filename="my.module.ts" | ||
[code]="exampleModule" | ||
></tui-doc-code> | ||
</li> | ||
|
||
<li> | ||
<p>Add to the template:</p> | ||
|
||
<tui-doc-code | ||
filename="my.component.html" | ||
[code]="exampleHtml" | ||
></tui-doc-code> | ||
</li> | ||
</ol> | ||
</ng-template> | ||
</tui-doc-page> |
18 changes: 18 additions & 0 deletions
18
projects/demo/src/modules/experimental/block-details/examples/1/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div tuiBlockDetails> | ||
<tui-avatar | ||
src="JW" | ||
[size]="isMobile ? 'xl' : 'xxl'" | ||
></tui-avatar> | ||
<h2 tuiTitle> | ||
John W | ||
<div tuiSubtitle>money transfers</div> | ||
</h2> | ||
|
||
<span>{{ -1050 | tuiAmount: 'USD' | async }}</span> | ||
<span tuiAmountDescription>today</span> | ||
<span tuiComment>Birthday gift</span> | ||
<div tuiAccessories> | ||
<tui-badge appearance="neutral">private</tui-badge> | ||
<tui-badge appearance="default">fast</tui-badge> | ||
</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
projects/demo/src/modules/experimental/block-details/examples/1/index.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
width: 15rem; | ||
} |
15 changes: 15 additions & 0 deletions
15
projects/demo/src/modules/experimental/block-details/examples/1/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Component, Inject} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TUI_IS_MOBILE} from '@taiga-ui/cdk'; | ||
|
||
@Component({ | ||
selector: 'tui-block-details-example-1', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiBlockDetailsExample1 { | ||
constructor(@Inject(TUI_IS_MOBILE) readonly isMobile: boolean) {} | ||
} |
37 changes: 37 additions & 0 deletions
37
projects/demo/src/modules/experimental/block-details/examples/2/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<div> | ||
<div tuiBlockDetails> | ||
<tui-avatar | ||
src="tuiIconGiftLarge" | ||
[size]="isMobile ? 'xl' : 'xxl'" | ||
></tui-avatar> | ||
<h2 tuiTitle> | ||
Auchan | ||
<div tuiSubtitle>grocery • MMC 5350</div> | ||
</h2> | ||
|
||
<span [style.color]="'var(--tui-positive)'">{{ 0.5 | tuiAmount: 'USD' | async }}</span> | ||
<span | ||
tuiAmountDescription | ||
tuiFade | ||
> | ||
promotion (long value with fade) | ||
</span> | ||
|
||
<tui-badge appearance="neutral">cashback</tui-badge> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div tuiBlockDetails> | ||
<tui-avatar | ||
src="tuiIconStarLarge" | ||
[size]="isMobile ? 'xl' : 'xxl'" | ||
></tui-avatar> | ||
<h2 tuiTitle> | ||
Uber | ||
<div tuiSubtitle>taxi • MMC 5550</div> | ||
</h2> | ||
|
||
<span [style.color]="'var(--tui-negative)'">{{ -10.5 | tuiAmount: 'USD' | async }}</span> | ||
</div> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
projects/demo/src/modules/experimental/block-details/examples/2/index.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 5rem; | ||
} | ||
|
||
[tuiAmountDescription] { | ||
white-space: nowrap; | ||
max-width: 7rem; | ||
} |
17 changes: 17 additions & 0 deletions
17
projects/demo/src/modules/experimental/block-details/examples/2/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Component, Inject} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TUI_IS_MOBILE} from '@taiga-ui/cdk'; | ||
import {tuiAmountOptionsProvider} from '@taiga-ui/experimental'; | ||
|
||
@Component({ | ||
selector: 'tui-block-details-example-2', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
providers: [tuiAmountOptionsProvider({sign: 'always'})], | ||
}) | ||
export class TuiBlockDetailsExample2 { | ||
constructor(@Inject(TUI_IS_MOBILE) readonly isMobile: boolean) {} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ts/demo/src/modules/experimental/block-details/examples/import/import-module.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
```ts | ||
import {NgModule} from '@angular/core'; | ||
import {TuiBlockDetailsModule} from '@taiga-ui/experimental'; | ||
// ... | ||
|
||
@NgModule({ | ||
imports: [ | ||
// ... | ||
TuiBlockDetailsModule, | ||
], | ||
}) | ||
export class MyModule {} | ||
``` |
14 changes: 14 additions & 0 deletions
14
.../demo/src/modules/experimental/block-details/examples/import/insert-template.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
```html | ||
<div tuiBlockDetails> | ||
<tui-avatar></tui-avatar> | ||
<h2 tuiTitle> | ||
Title | ||
<div tuiSubtitle>Subtitle</div> | ||
</h2> | ||
|
||
<span>{{ amount }} | tuiAmount: 'USD' | async }}</span> | ||
<span tuiAmountDescription>description</span> | ||
<span tuiComment>comment</span> | ||
<tui-badge appearance="neutral">Badge</tui-badge> | ||
</div> | ||
``` |
12 changes: 12 additions & 0 deletions
12
projects/experimental/directives/block-details/block-details.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; | ||
|
||
@Component({ | ||
template: '', | ||
styleUrls: ['./block-details.style.less'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
host: { | ||
class: 'tui-block-details-styles', | ||
}, | ||
}) | ||
export class TuiBlockDetailsComponent {} |
15 changes: 15 additions & 0 deletions
15
projects/experimental/directives/block-details/block-details.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Directive, Inject} from '@angular/core'; | ||
import {TuiDirectiveStylesService} from '@taiga-ui/cdk'; | ||
|
||
import {TuiBlockDetailsComponent} from './block-details.component'; | ||
|
||
@Directive({ | ||
selector: '[tuiBlockDetails]', | ||
}) | ||
export class TuiBlockDetailsDirective { | ||
constructor( | ||
@Inject(TuiDirectiveStylesService) directiveStyles: TuiDirectiveStylesService, | ||
) { | ||
directiveStyles.addComponent(TuiBlockDetailsComponent); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
projects/experimental/directives/block-details/block-details.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {NgModule} from '@angular/core'; | ||
|
||
import {TuiBlockDetailsComponent} from './block-details.component'; | ||
import {TuiBlockDetailsDirective} from './block-details.directive'; | ||
|
||
@NgModule({ | ||
declarations: [TuiBlockDetailsDirective, TuiBlockDetailsComponent], | ||
exports: [TuiBlockDetailsDirective], | ||
}) | ||
export class TuiBlockDetailsModule {} |
Oops, something went wrong.