fix(storybook): register appThemeApiRef in Storybook API providers
Add AppThemeSelector as an implementation for appThemeApiRef in the shared Storybook API registry. Without this, any story that renders a ToastContainer fails with NotImplementedError for core.apptheme. Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
AlertApiForwarder,
|
||||
AppThemeSelector,
|
||||
ErrorAlerter,
|
||||
ErrorApiForwarder,
|
||||
GithubAuth,
|
||||
@@ -13,6 +14,7 @@ import {
|
||||
|
||||
import {
|
||||
alertApiRef,
|
||||
appThemeApiRef,
|
||||
errorApiRef,
|
||||
githubAuthApiRef,
|
||||
gitlabAuthApiRef,
|
||||
@@ -24,10 +26,16 @@ import {
|
||||
featureFlagsApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
import { themes } from '@backstage/theme';
|
||||
|
||||
import { translationApiRef } from '@backstage/core-plugin-api/alpha';
|
||||
import { MockTranslationApi } from '@backstage/test-utils/alpha';
|
||||
|
||||
const configApi = new ConfigReader({});
|
||||
const appThemeApi = AppThemeSelector.createWithStorage([
|
||||
{ id: 'light', title: 'Light', variant: 'light', theme: themes.light },
|
||||
{ id: 'dark', title: 'Dark', variant: 'dark', theme: themes.dark },
|
||||
]);
|
||||
const featureFlagsApi = new LocalStorageFeatureFlags();
|
||||
const alertApi = new AlertApiForwarder();
|
||||
const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());
|
||||
@@ -62,6 +70,7 @@ const translationApi = MockTranslationApi.create();
|
||||
|
||||
export const apis = [
|
||||
[configApiRef, configApi],
|
||||
[appThemeApiRef, appThemeApi],
|
||||
[featureFlagsApiRef, featureFlagsApi],
|
||||
[alertApiRef, alertApi],
|
||||
[errorApiRef, errorApi],
|
||||
|
||||
Reference in New Issue
Block a user