Ghost/ghost/admin/app/components/announcement-settings/background.js
Elena Baidakova f69674ff9a
Fixed announcement bar preview (#16715)
refs TryGhost/Team#3122
- Fixed that preview takes data from user input before saving on
backend.

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 54d5b2d</samp>

This pull request adds the ability to preview the announcement bar in
the Ghost admin panel and the theme settings. It also adds a
confirmation dialog to discard or save unsaved changes before leaving
the announcement bar settings. It refactors some components and methods
to remove unnecessary or redundant calls to save the settings. It
modifies the `ghost_head` helper, the `theme-management` service, and
the `announcement-bar/src` files to support the preview feature.
2023-04-27 16:40:11 +04:00

26 lines
763 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
export default class AnnouncementSettingsBackgroundComponent extends Component {
@service settings;
get background() {
return this.settings.announcementBackground;
}
get options() {
return [
{value: 'dark', label: 'Dark', className: 'kg-headerstyle-btn-dark'},
{value: 'light', label: 'Light', className: 'kg-headerstyle-btn-light'},
{value: 'accent', label: 'Accent', className: 'kg-headerstyle-btn-accent'}
];
}
@action
setBackground(value) {
this.settings.announcementBackground = value;
this.args.onChange?.();
}
}