DEV: Add high level system spec and clean up JS (#34)
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { action } from "@ember/object";
|
||||
import Service from "@ember/service";
|
||||
import Service, { service } from "@ember/service";
|
||||
import { DEFAULT_PALETTE_NAME } from "../components/custom-user-palette";
|
||||
|
||||
export default class customColor extends Service {
|
||||
@tracked color = localStorage.getItem("d-customColor") || "horizon";
|
||||
const CUSTOM_COLOR_KEY = "d-custom-color-preference";
|
||||
|
||||
export default class CustomColor extends Service {
|
||||
@service keyValueStore;
|
||||
@tracked
|
||||
color = this.keyValueStore.getItem(CUSTOM_COLOR_KEY) || DEFAULT_PALETTE_NAME;
|
||||
|
||||
@action
|
||||
setColor(color) {
|
||||
this.color = color;
|
||||
localStorage.setItem("d-customColor", color);
|
||||
this.keyValueStore.setItem(CUSTOM_COLOR_KEY, color);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user