Web: Components: Add RTL-switcher to new Storybook

This commit is contained in:
Aleksandr Lushkin 2023-06-02 11:08:39 +02:00
parent 122fc51d6a
commit c239f7a67d
2 changed files with 14 additions and 2 deletions

View File

@ -9,6 +9,16 @@ const globalTypes = {
dynamicTitle: true,
},
},
direction: {
description: "Interface direction",
defaultValue: "ltr",
toolbar: {
title: "Dir",
icon: "paragraph",
items: ["ltr", "rtl"],
dynamicTitle: true,
},
},
};
export default globalTypes;

View File

@ -26,9 +26,11 @@ const preview = {
},
decorators: [
(Story, context) => {
const theme = context.globals.theme;
const theme = context.globals.theme === "Dark" ? Dark : Base;
const interfaceDirection = context.globals.direction;
return (
<ThemeWrapper theme={theme === "Dark" ? Dark : Base}>
<ThemeWrapper theme={{ ...theme, interfaceDirection }}>
<Story />
</ThemeWrapper>
);