mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-22 22:29:30 +00:00
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
/*
|
|
Copyright 2026 Element Creations Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import type { Preview } from "@storybook/react-vite";
|
|
import { TooltipProvider } from "@vector-im/compound-web";
|
|
import { logger } from "matrix-js-sdk/lib/logger";
|
|
|
|
import EN from "../locales/en/app.json";
|
|
import { Config } from "../src/config/Config";
|
|
import { initReactI18next } from "react-i18next";
|
|
import { i18n } from "../src/utils/i18n";
|
|
import "../src/index.css";
|
|
|
|
// Bare-minimum i18n config.
|
|
// Unlike the app, stories register the instance as react-i18next's default
|
|
// rather than wrapping every story in an <I18nextProvider>.
|
|
i18n
|
|
.use(initReactI18next)
|
|
.init({
|
|
lng: "en",
|
|
fallbackLng: "en",
|
|
supportedLngs: ["en"],
|
|
// We embed the translations, so that it never needs to fetch
|
|
resources: {
|
|
en: {
|
|
translation: EN,
|
|
},
|
|
},
|
|
interpolation: {
|
|
escapeValue: false, // React has built-in XSS protections
|
|
},
|
|
})
|
|
.catch((e) => logger.warn("Failed to init i18n for stories", e));
|
|
|
|
// Stories run without a config.json; the defaults stand in, as they do for
|
|
// a component host that passes none.
|
|
Config.initWith({});
|
|
|
|
const preview: Preview = {
|
|
parameters: {
|
|
layout: "centered",
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/i,
|
|
},
|
|
},
|
|
},
|
|
tags: ["autodocs"],
|
|
decorators: [
|
|
(Story) => (
|
|
<TooltipProvider>
|
|
<Story />
|
|
</TooltipProvider>
|
|
),
|
|
],
|
|
};
|
|
|
|
export default preview;
|