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:
Charles de Dreuille
2026-03-30 11:49:34 +01:00
parent 6d120233a2
commit e21dd5edc4
+9
View File
@@ -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],