Files
threshold-ui/ui/desktop/app/controllers/scopes/scope/projects/settings/index.js
T
Dharini Jeeva 777380e19f Add theme selection (#2428)
* fix: 🐛 remove theme from main menu bar and move to settings pag

* chore: 🤖 move toggletheme to app controller
2024-09-24 11:58:24 -04:00

49 lines
939 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Controller, { inject as controller } from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
const THEMES = [
{
label: 'system',
value: 'system-default-theme',
},
{
label: 'light',
value: 'light',
},
{
label: 'dark',
value: 'dark',
},
];
export default class ScopesScopeProjectsSettingsIndexController extends Controller {
@controller('application') application;
// Services
@service session;
// Methods
/**
* Returns available themes
*/
get themes() {
return THEMES;
}
/**
* Calls the Application controller's toggleTheme method
* @param {string} theme - "light", "dark", or nullish (system default)
*/
@action
toggleTheme({ target: { value: theme } }) {
return this.application.toggleTheme(theme);
}
}