-
Couldn't load subscription status.
- Fork 285
Introduction Tooltip Components #1175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
duckaxe
wants to merge
9
commits into
bitaxeorg:master
Choose a base branch
from
duckaxe:feature/introduction-tooltip-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
49b6a06
Introduction Tooltip Components
0c052d0
Simplify <tooltip-icon> embed
1021ceb
Add split param to manage word splitting
ff9f716
Merge branch 'master' into feature/introduction-tooltip-components
duckaxe d7f272a
Merge branch 'master' into feature/introduction-tooltip-components
duckaxe 447acdf
Merge branch 'master' into feature/introduction-tooltip-components
duckaxe f97c7ff
Merge branch 'master' into feature/introduction-tooltip-components
duckaxe 55acf9e
Merge branch 'master' into feature/introduction-tooltip-components
duckaxe 649e776
Merge branch 'master' into feature/introduction-tooltip-components
duckaxe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
7 changes: 6 additions & 1 deletion
7
main/http_server/axe-os/src/app/components/network-edit/network.edit.component.html
This file contains hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
main/http_server/axe-os/src/app/components/tooltip-icon/tooltip-icon.component.html
This file contains hidden or 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 @@ | ||
| <ng-container *ngIf="tooltip"> | ||
| <i *ngIf="!isMobile" pTooltip="{{tooltip}}" [ngClass]="tooltipIconClass"></i> | ||
|
|
||
| <button *ngIf="isMobile" (click)="showMobileTooltip = true" [ngClass]="tooltipIconClass"></button> | ||
|
|
||
| <div *ngIf="showMobileTooltip" (click)="showMobileTooltip = false" class="tooltip-mobile-backdrop"> | ||
| <div class="tooltip-mobile-content"> | ||
| <button class="tooltip-mobile-close" (click)="showMobileTooltip = false">×</button> | ||
| <p>{{ tooltip }}</p> | ||
| </div> | ||
| </div> | ||
| </ng-container> |
45 changes: 45 additions & 0 deletions
45
main/http_server/axe-os/src/app/components/tooltip-icon/tooltip-icon.component.scss
This file contains hidden or 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,45 @@ | ||
| .tooltip-icon { | ||
| appearance: none; | ||
| border: none; | ||
| outline: none; | ||
| background: none; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .tooltip-mobile { | ||
| &-backdrop { | ||
| background-color: rgba(0, 0, 0, 0.5); | ||
| top: 0; | ||
| bottom: 0; | ||
| left: 0; | ||
| right: 0; | ||
| position: fixed; | ||
| z-index: 9; | ||
| display: flex; | ||
| align-items: flex-end; | ||
| } | ||
|
|
||
| &-content { | ||
| width: 100%; | ||
| background: var(--surface-d); | ||
| color: #fff; | ||
| padding: 1.5rem 4rem 1.5rem 1.5rem; | ||
| border-radius: 1.5rem 1.5rem 0 0; | ||
| position: relative; | ||
| white-space: normal; | ||
| } | ||
|
|
||
| &-close { | ||
| width: 20px; | ||
| height: 20px; | ||
| position: absolute; | ||
| right: 1.5rem; | ||
| top: 1.5rem; | ||
| border: none; | ||
| background: var(--button-bg); | ||
| font-size: 18px; | ||
| line-height: 18px; | ||
| display: flex; | ||
| justify-content: center; | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
main/http_server/axe-os/src/app/components/tooltip-icon/tooltip-icon.component.spec.ts
This file contains hidden or 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 { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
|
||
| import { TooltipIconComponent } from './tooltip-icon.component'; | ||
|
|
||
| describe('WifiIconComponent', () => { | ||
| let component: TooltipIconComponent; | ||
| let fixture: ComponentFixture<TooltipIconComponent>; | ||
|
|
||
| beforeEach(() => { | ||
| TestBed.configureTestingModule({ | ||
| declarations: [TooltipIconComponent] | ||
| }); | ||
| fixture = TestBed.createComponent(TooltipIconComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
| }); |
15 changes: 15 additions & 0 deletions
15
main/http_server/axe-os/src/app/components/tooltip-icon/tooltip-icon.component.ts
This file contains hidden or 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, Input, HostListener } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'tooltip-icon', | ||
| templateUrl: './tooltip-icon.component.html', | ||
| styleUrls: ['./tooltip-icon.component.scss'], | ||
| }) | ||
| export class TooltipIconComponent { | ||
| @Input() tooltip: string = ''; | ||
| @Input() size: string = 'xs'; | ||
|
|
||
| showMobileTooltip = false; | ||
| tooltipIconClass = `pi pi-question-circle text-${this.size} pl-1 pr-2 tooltip-icon`; | ||
| isMobile = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0); | ||
| } |
19 changes: 19 additions & 0 deletions
19
.../http_server/axe-os/src/app/components/tooltip-text-icon/tooltip-text-icon.component.html
This file contains hidden or 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,19 @@ | ||
| <ng-container *ngIf="tooltip; else noTooltip"> | ||
| <ng-container *ngIf="split; else noSplit"> | ||
| <span *ngIf="preLastWords">{{ preLastWords }} </span> | ||
|
|
||
| <span class="white-space-nowrap"> | ||
| {{ lastWord }}<tooltip-icon [tooltip]="tooltip" /> | ||
| </span> | ||
| </ng-container> | ||
|
|
||
| <ng-template #noSplit> | ||
| <span class="white-space-nowrap"> | ||
| {{ text }}<tooltip-icon [tooltip]="tooltip" /> | ||
| </span> | ||
| </ng-template> | ||
| </ng-container> | ||
|
|
||
| <ng-template #noTooltip> | ||
| {{ text }} | ||
| </ng-template> |
21 changes: 21 additions & 0 deletions
21
...tp_server/axe-os/src/app/components/tooltip-text-icon/tooltip-text-icon.component.spec.ts
This file contains hidden or 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 { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
|
||
| import { TooltipTextIconComponent } from './tooltip-text-icon.component'; | ||
|
|
||
| describe('WifiIconComponent', () => { | ||
| let component: TooltipTextIconComponent; | ||
| let fixture: ComponentFixture<TooltipTextIconComponent>; | ||
|
|
||
| beforeEach(() => { | ||
| TestBed.configureTestingModule({ | ||
| declarations: [TooltipTextIconComponent] | ||
| }); | ||
| fixture = TestBed.createComponent(TooltipTextIconComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
| }); |
33 changes: 33 additions & 0 deletions
33
main/http_server/axe-os/src/app/components/tooltip-text-icon/tooltip-text-icon.component.ts
This file contains hidden or 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,33 @@ | ||
| import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'tooltip-text-icon', | ||
| templateUrl: './tooltip-text-icon.component.html', | ||
| }) | ||
| export class TooltipTextIconComponent implements OnChanges { | ||
| @Input() tooltip: string | null = ''; | ||
| @Input() text: string | null = ''; | ||
| @Input() split: boolean = true; | ||
|
|
||
| preLastWords: string = ''; | ||
| lastWord: string = ''; | ||
|
|
||
| ngOnChanges(changes: SimpleChanges): void { | ||
| const safeText = (this.text ?? '').trim(); | ||
|
|
||
| if ('text' in changes && safeText) { | ||
| const words = safeText.split(/\s+/); | ||
|
|
||
| if (words.length > 1) { | ||
| this.preLastWords = words.slice(0, words.length - 1).join(' '); | ||
| this.lastWord = words[words.length - 1]; | ||
| } else { | ||
| this.preLastWords = ''; | ||
| this.lastWord = safeText; | ||
| } | ||
| } else { | ||
| this.preLastWords = ''; | ||
| this.lastWord = ''; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
9 changes: 6 additions & 3 deletions
9
main/http_server/axe-os/src/app/layout/styles/layout/_variables.scss
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| /* General */ | ||
| $scale:14px; /* main font size */ | ||
| $borderRadius:0px; /* border radius of layout element e.g. card, sidebar */ | ||
| $transitionDuration:.2s; /* transition duration of layout elements e.g. sidebar, overlay menus */ | ||
| $scale:14px; /* main font size */ | ||
| $borderRadius:0px; /* border radius of layout element e.g. card, sidebar */ | ||
| $transitionDuration:.2s; /* transition duration of layout elements e.g. sidebar, overlay menus */ | ||
|
|
||
| $tooltipBg: var(--surface-d); | ||
| $borderRadius: 2px; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.