-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs) refactors floating docs (#173)
- Loading branch information
Showing
22 changed files
with
280 additions
and
99 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...overs/src/app/pages/documentation/page-core/page-floating/examples/1/index.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,16 @@ | ||
<div #reference> | ||
<p>Reference content</p> | ||
</div> | ||
|
||
<ngx-floating | ||
[reference]="reference" | ||
[middleware]="middleware" | ||
placement="bottom" | ||
bindTo=".page" | ||
> | ||
<div class="floating"> | ||
<p>Floating content</p> | ||
</div> | ||
|
||
<ngx-arrow padding="12" /> | ||
</ngx-floating> |
6 changes: 6 additions & 0 deletions
6
...overs/src/app/pages/documentation/page-core/page-floating/examples/1/index.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,6 @@ | ||
.floating { | ||
padding: 10px; | ||
background: theme('colors.base-100'); | ||
border: 1px solid theme('colors.primary'); | ||
border-radius: 4px; | ||
} |
21 changes: 21 additions & 0 deletions
21
...rs/src/app/pages/documentation/page-core/page-floating/examples/1/index.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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { IndexComponent } from './index.component'; | ||
|
||
describe('IndexComponent', () => { | ||
let component: IndexComponent; | ||
let fixture: ComponentFixture<IndexComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [IndexComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(IndexComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
...opovers/src/app/pages/documentation/page-core/page-floating/examples/1/index.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,22 @@ | ||
import { Component } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { Arrow, flip, FloatingComponent, offset, shift } from '@ngx-popovers/core'; | ||
|
||
@Component({ | ||
selector: 'demo-index', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
FloatingComponent, | ||
Arrow | ||
], | ||
templateUrl: './index.component.html', | ||
styleUrl: './index.component.scss' | ||
}) | ||
export class IndexComponent { | ||
middleware = [ | ||
flip(), | ||
shift(), | ||
offset(8) | ||
]; | ||
} |
31 changes: 31 additions & 0 deletions
31
...overs/src/app/pages/documentation/page-core/page-floating/examples/2/index.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,31 @@ | ||
<div #reference class="flex flex-col gap-2 w-[120px] p-2 m-auto items-center bg-base-300 overflow-hidden"> | ||
@for (place of placementList; track place) { | ||
<button | ||
class="btn btn-sm w-[100px]" | ||
[class.btn-primary]="place === placement()" | ||
(click)="placement.set(place)" | ||
> | ||
{{ place }} | ||
</button> | ||
} | ||
</div> | ||
|
||
<ngx-floating | ||
bindTo=".page" | ||
[reference]="reference" | ||
[placement]="placement()" | ||
[middleware]="middleware" | ||
> | ||
<div class="card bg-base-100 border-4 border-base-200"> | ||
<div class="card-body items-center text-center"> | ||
<h2 class="card-title">Floating</h2> | ||
|
||
<pre [innerText]="'<ngx-floating />'"></pre> | ||
<div class="card-actions"> | ||
<button class="btn btn-sm btn-primary">{{ placement() }}</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<ngx-arrow padding="20" /> | ||
</ngx-floating> |
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
...rs/src/app/pages/documentation/page-core/page-floating/examples/2/index.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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { IndexComponent } from './index.component'; | ||
|
||
describe('IndexComponent', () => { | ||
let component: IndexComponent; | ||
let fixture: ComponentFixture<IndexComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [IndexComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(IndexComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
...opovers/src/app/pages/documentation/page-core/page-floating/examples/2/index.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,34 @@ | ||
import { Component, ElementRef, inject, signal } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { Arrow, FloatingComponent, Middleware, offset, Placement } from '@ngx-popovers/core'; | ||
import { flip } from '@floating-ui/dom'; | ||
|
||
@Component({ | ||
selector: 'demo-index', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
Arrow, | ||
FloatingComponent | ||
], | ||
templateUrl: './index.component.html', | ||
styleUrl: './index.component.scss' | ||
}) | ||
export class IndexComponent { | ||
readonly elementRef: HTMLElement = inject(ElementRef).nativeElement; | ||
readonly placement = signal<Placement>('left'); | ||
|
||
readonly placementList: Placement[] = [ | ||
'left', | ||
'bottom', | ||
'right', | ||
'top' | ||
]; | ||
|
||
readonly middleware: Middleware[] = [ | ||
offset(10), | ||
flip({ | ||
fallbackStrategy: 'initialPlacement' | ||
}) | ||
]; | ||
} |
14 changes: 14 additions & 0 deletions
14
...overs/src/app/pages/documentation/page-core/page-floating/examples/3/index.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,14 @@ | ||
<div #reference> | ||
<p>Reference content</p> | ||
</div> | ||
|
||
<ngx-floating | ||
[reference]="reference" | ||
bindTo=".page" | ||
> | ||
<div class="floating"> | ||
<p>Floating content</p> | ||
</div> | ||
|
||
<ngx-arrow padding="12" /> | ||
</ngx-floating> |
6 changes: 6 additions & 0 deletions
6
...overs/src/app/pages/documentation/page-core/page-floating/examples/3/index.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,6 @@ | ||
.floating { | ||
padding: 10px; | ||
background: theme('colors.base-100'); | ||
border: 1px solid theme('colors.primary'); | ||
border-radius: 4px; | ||
} |
21 changes: 21 additions & 0 deletions
21
...rs/src/app/pages/documentation/page-core/page-floating/examples/3/index.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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { IndexComponent } from './index.component'; | ||
|
||
describe('IndexComponent', () => { | ||
let component: IndexComponent; | ||
let fixture: ComponentFixture<IndexComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [IndexComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(IndexComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
...opovers/src/app/pages/documentation/page-core/page-floating/examples/3/index.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,25 @@ | ||
import { Component, Provider } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { Arrow, FloatingComponent, NGX_FLOATING_CONFIG, NgxFloatingConfig, offset } from '@ngx-popovers/core'; | ||
|
||
export const FloatingConfigProvider: Provider = { | ||
provide: NGX_FLOATING_CONFIG, | ||
useValue: new NgxFloatingConfig({ | ||
placement: 'right-start', | ||
autoUpdate: false, | ||
middleware: [ | ||
offset(40) | ||
] | ||
}) | ||
}; | ||
|
||
@Component({ | ||
selector: 'demo-index', | ||
standalone: true, | ||
imports: [CommonModule, Arrow, FloatingComponent], | ||
providers: [FloatingConfigProvider], | ||
templateUrl: './index.component.html', | ||
styleUrl: './index.component.scss' | ||
}) | ||
export class IndexComponent { | ||
} |
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
Oops, something went wrong.