diff --git a/CHANGELOG.md b/CHANGELOG.md index 3579ce139..56289283d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix issue where scene connection lines could get stuck in place if custom scripts that change scenes are called multiple times from the same scene - Fix issue where "Replace Script" confirmation alert would appear when pasting sometimes even if the custom script hadn't been modified - Fix issue preventing building projects containing a "Play Music" event but no music +- Fix issue where dialogue script events could cause horizontal scroll bars to appear in script editor when column was not wide enough to display all tabs ## [4.1.2] - 2024-09-09 diff --git a/src/components/ui/tabs/style.ts b/src/components/ui/tabs/style.ts index 93774248a..c61101369 100644 --- a/src/components/ui/tabs/style.ts +++ b/src/components/ui/tabs/style.ts @@ -51,6 +51,7 @@ export const StyledTabBar = styled.div` margin-top: -5px; margin-bottom: 5px; flex-basis: 100%; + width: 100%; background: ${(props) => props.theme.colors.sidebar.background}; ` : ""} diff --git a/src/stories/ui/tabs/TabBar.stories.tsx b/src/stories/ui/tabs/TabBar.stories.tsx new file mode 100644 index 000000000..6857eb226 --- /dev/null +++ b/src/stories/ui/tabs/TabBar.stories.tsx @@ -0,0 +1,171 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { fn } from "@storybook/test"; +import React, { useContext } from "react"; +import { ThemeContext } from "styled-components"; +import { StickyTabs, TabBar } from "ui/tabs/Tabs"; + +// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export +const meta: Meta = { + title: "UI/Tabs/TabBar", + component: TabBar, + parameters: { + // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout + layout: "centered", + }, + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs + tags: ["autodocs"], + // More on argTypes: https://storybook.js.org/docs/api/argtypes + argTypes: { + variant: { + control: "select", + }, + }, + // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args + args: { onChange: fn() }, + decorators: [ + (Story) => ( +
+ +
+ ), + ], +}; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args +export const Normal: Story = { + args: { + value: "script", + values: { script: "On Interact", init: "On Init", update: "On Update" }, + }, + decorators: [ + (Story) => ( + + + + ), + ], +}; + +export const Overflowing: Story = { + args: { + value: "script", + values: { + script: "On Interact", + init: "On Init", + update: "On Update", + enter: "On Enter", + leave: "On Leave", + }, + }, + decorators: [ + (Story) => ( + + + + ), + ], +}; + +export const Secondary: Story = { + args: { + variant: "secondary", + value: "script", + values: { script: "On Interact", init: "On Init", update: "On Update" }, + }, +}; + +export const OverflowingSecondary: Story = { + args: { + variant: "secondary", + value: "script", + values: { + script: "On Interact", + init: "On Init", + update: "On Update", + enter: "On Enter", + leave: "On Leave", + }, + }, + decorators: [ + (Story) => ( + + + + ), + ], +}; + +export const ScriptEventTabs: Story = { + args: { + variant: "scriptEvent", + value: "script", + values: { script: "On Interact", init: "On Init", update: "On Update" }, + }, + decorators: [ + (Story) => { + const themeContext = useContext(ThemeContext); + return ( +
+ +
+ ); + }, + ], +}; + +export const OverflowingScriptEventTabs: Story = { + args: { + variant: "scriptEvent", + value: "script", + values: { + script: "On Interact", + init: "On Init", + update: "On Update", + enter: "On Enter", + leave: "On Leave", + }, + }, + decorators: [ + (Story) => { + const themeContext = useContext(ThemeContext); + return ( +
+ +
+ ); + }, + ], +}; + +export const EventSectionTabs: Story = { + args: { + variant: "eventSection", + value: "script", + values: { script: "On Interact", init: "On Init", update: "On Update" }, + }, +}; + +export const OverflowingEventSectionTabs: Story = { + args: { + variant: "eventSection", + value: "script", + values: { + script: "On Interact", + init: "On Init", + update: "On Update", + enter: "On Enter", + leave: "On Leave", + }, + }, +};