fixes #95
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import {Component, computed, inject, input} from '@angular/core';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { StyleClassModule } from 'primeng/styleclass';
|
||||
import { AppConfigurator } from './app.configurator';
|
||||
import { LayoutService } from '../service/layout.service';
|
||||
import {CommonModule} from "@angular/common";
|
||||
|
||||
@Component({
|
||||
selector: 'app-floating-configurator',
|
||||
imports: [ButtonModule, StyleClassModule, AppConfigurator],
|
||||
imports: [CommonModule, ButtonModule, StyleClassModule, AppConfigurator],
|
||||
template: `
|
||||
<div class="fixed flex gap-4 top-8 right-8">
|
||||
<div class="flex gap-4 top-8 right-8" [ngClass]="{'fixed':float()}">
|
||||
<p-button type="button" (onClick)="toggleDarkMode()" [rounded]="true" [icon]="isDarkTheme() ? 'pi pi-moon' : 'pi pi-sun'" severity="secondary" />
|
||||
<div class="relative">
|
||||
<p-button icon="pi pi-palette" pStyleClass="@next" enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true" type="button" rounded />
|
||||
@@ -20,9 +21,12 @@ import { LayoutService } from '../service/layout.service';
|
||||
export class AppFloatingConfigurator {
|
||||
LayoutService = inject(LayoutService);
|
||||
|
||||
float = input<boolean>(true);
|
||||
|
||||
isDarkTheme = computed(() => this.LayoutService.layoutConfig().darkTheme);
|
||||
|
||||
toggleDarkMode() {
|
||||
this.LayoutService.layoutConfig.update((state) => ({ ...state, darkTheme: !state.darkTheme }));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user