-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae30e35
commit 910f95b
Showing
9 changed files
with
238 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
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
22 changes: 22 additions & 0 deletions
22
...s/ngx-tippy-demo/src/app/pages/grouped-tooltips/_tests/grouped-tooltips.component.spec.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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { GroupedTooltipsComponent } from '../grouped-tooltips.component'; | ||
|
||
describe('GroupedTooltipsComponent', () => { | ||
let component: GroupedTooltipsComponent; | ||
let fixture: ComponentFixture<GroupedTooltipsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [GroupedTooltipsComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(GroupedTooltipsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
105 changes: 105 additions & 0 deletions
105
projects/ngx-tippy-demo/src/app/pages/grouped-tooltips/grouped-tooltips.component.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,105 @@ | ||
<div class="grouped"> | ||
|
||
<h1 class="tui-text_h3">Grouped tooltips</h1> | ||
|
||
<p class="tui-text_body-m-2"> | ||
If you need to provide unique tooltip content to multiple elements but only initialize once, use the ngx-tippy-group | ||
component. | ||
</p> | ||
|
||
<tui-notification | ||
status="info" | ||
class="service-demo tui-space_vertical-4" | ||
> | ||
For each tooltip within <em>ngx-tippy-group</em> component you should pass <em>data-tippy-grouped</em> attribute | ||
</tui-notification> | ||
|
||
<t-demo-code | ||
*tuiLet="snippets.grouped_template as s" | ||
[snippet]="s.snippet" | ||
[languages]="s.languages" | ||
></t-demo-code> | ||
|
||
<t-demo-code | ||
*tuiLet="snippets.grouped_component as s" | ||
[snippet]="s.snippet" | ||
[languages]="s.languages" | ||
></t-demo-code> | ||
|
||
<t-demo> | ||
<ngx-tippy-group [groupedProps]="groupedProps"> | ||
<button | ||
*ngFor="let btn of [0, 1, 2, 3, 4]" | ||
data-tippy-grouped | ||
data-tippy-content="Tooltip content" | ||
class="tui-button tui-button-{{btn}}" | ||
size="m" | ||
tuiButton | ||
type="button" | ||
appearance="primary" | ||
> | ||
Button | ||
</button> | ||
</ngx-tippy-group> | ||
</t-demo> | ||
|
||
<p class="tui-text_body-m-2"> | ||
Also you can pass new content and props through attribute for every tooltip element, see <a | ||
tuiLink | ||
href="https://atomiks.github.io/tippyjs/v6/customization/" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
customization | ||
</a> | ||
</p> | ||
|
||
<t-demo-code | ||
*tuiLet="snippets.grouped_custom_template as s" | ||
[snippet]="s.snippet" | ||
[languages]="s.languages" | ||
></t-demo-code> | ||
|
||
<t-demo> | ||
<ngx-tippy-group [groupedProps]="groupedProps"> | ||
<button | ||
data-tippy-grouped | ||
data-tippy-content="Tooltip content" | ||
class="tui-button" | ||
size="m" | ||
tuiButton | ||
type="button" | ||
appearance="primary" | ||
> | ||
Button | ||
</button> | ||
|
||
<button | ||
data-tippy-grouped | ||
data-tippy-arrow="true" | ||
data-tippy-content="New tooltip content" | ||
class="tui-button" | ||
size="m" | ||
tuiButton | ||
type="button" | ||
appearance="primary" | ||
> | ||
Button | ||
</button> | ||
|
||
<button | ||
data-tippy-grouped | ||
data-tippy-placement="right" | ||
data-tippy-content="Another tooltip content" | ||
class="tui-button" | ||
size="m" | ||
tuiButton | ||
type="button" | ||
appearance="primary" | ||
> | ||
Button | ||
</button> | ||
</ngx-tippy-group> | ||
</t-demo> | ||
|
||
</div> |
7 changes: 7 additions & 0 deletions
7
projects/ngx-tippy-demo/src/app/pages/grouped-tooltips/grouped-tooltips.component.scss
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,7 @@ | ||
.tui-text_h3 { | ||
margin-top: 0; | ||
} | ||
|
||
.tui-button:not(:first-child) { | ||
margin-left: 1rem; | ||
} |
21 changes: 21 additions & 0 deletions
21
projects/ngx-tippy-demo/src/app/pages/grouped-tooltips/grouped-tooltips.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,21 @@ | ||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; | ||
import { NgxTippyProps } from 'ngx-tippy-wrapper'; | ||
import { SNIPPETS } from './snippets'; | ||
|
||
@Component({ | ||
selector: 'app-grouped-tooltips', | ||
templateUrl: './grouped-tooltips.component.html', | ||
styleUrls: ['./grouped-tooltips.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class GroupedTooltipsComponent implements OnInit { | ||
public readonly snippets = SNIPPETS; | ||
public readonly groupedProps: NgxTippyProps = { | ||
arrow: false, | ||
placement: 'top', | ||
}; | ||
|
||
constructor() {} | ||
|
||
ngOnInit(): void {} | ||
} |
1 change: 1 addition & 0 deletions
1
projects/ngx-tippy-demo/src/app/pages/grouped-tooltips/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 @@ | ||
export { GroupedTooltipsComponent } from './grouped-tooltips.component'; |
64 changes: 64 additions & 0 deletions
64
projects/ngx-tippy-demo/src/app/pages/grouped-tooltips/snippets.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,64 @@ | ||
const GROUPED_TEMPLATE_SN = ` | ||
<ngx-tippy-group [groupedProps]="groupedProps"> | ||
<button | ||
*ngFor="let btn of [0, 1, 2, 3, 4]" | ||
data-tippy-grouped | ||
data-tippy-content="Tooltip content" | ||
> | ||
Button | ||
</button> | ||
</ngx-tippy-group> | ||
`; | ||
|
||
const GROUPED_COMPONENT_SN = ` | ||
import { NgxTippyProps } from 'ngx-tippy-wrapper'; | ||
@Component({ ... }) | ||
export class DemoComponent implements OnInit { | ||
groupedProps: NgxTippyProps = { | ||
arrow: false, | ||
placement: 'top', | ||
}; | ||
... | ||
}`; | ||
|
||
const GROUPED_CUSTOM_TEMPLATE_SN = ` | ||
<ngx-tippy-group [groupedProps]="groupedProps"> | ||
<button | ||
data-tippy-grouped | ||
data-tippy-content="Tooltip content" | ||
> | ||
Button | ||
</button> | ||
<button | ||
data-tippy-grouped | ||
data-tippy-arrow="true" | ||
data-tippy-content="New tooltip content" | ||
> | ||
Button | ||
</button> | ||
<button | ||
data-tippy-grouped | ||
data-tippy-placement="right" | ||
data-tippy-content="Another tooltip content" | ||
> | ||
Button | ||
</button> | ||
</ngx-tippy-group>`; | ||
|
||
export const SNIPPETS = { | ||
grouped_template: { | ||
snippet: GROUPED_TEMPLATE_SN, | ||
languages: ['html'], | ||
}, | ||
grouped_component: { | ||
snippet: GROUPED_COMPONENT_SN, | ||
languages: ['typescript'], | ||
}, | ||
grouped_custom_template: { | ||
snippet: GROUPED_CUSTOM_TEMPLATE_SN, | ||
languages: ['html'], | ||
}, | ||
}; |