1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-12 22:44:11 +00:00

add BitSettingsService

This commit is contained in:
William Martin
2024-10-30 14:30:36 -04:00
parent 6f6db5e782
commit 30704805d7
2 changed files with 16 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ export * from "./radio-button";
export * from "./search";
export * from "./section";
export * from "./select";
export * from "./shared/bit-settings.service";
export * from "./table";
export * from "./tabs";
export * from "./toast";

View File

@@ -0,0 +1,15 @@
import { effect, Injectable, signal, WritableSignal } from "@angular/core";
/** Global settings for the Bitwarden Design System */
@Injectable({ providedIn: "root" })
export class BitSettingsService {
compactMode: WritableSignal<boolean> = signal(false);
constructor() {
effect(() => {
this.compactMode()
? document.body.classList.add("tw-bit-compact")
: document.body.classList.remove("tw-bit-compact");
});
}
}