Skip to content

Commit

Permalink
docs: fix show hide event readability and make controls expanded as d…
Browse files Browse the repository at this point in the history
…efault
  • Loading branch information
shaharzil committed Apr 21, 2024
1 parent 6b1e520 commit 89f750a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
4 changes: 3 additions & 1 deletion packages/core/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const fontLoader = async () => ({
const preview: Preview = {
parameters: {
controls: {
sort: "alpha"
sort: "alpha",
expanded: true
},
docs: {
liveEdit: {
Expand Down Expand Up @@ -146,6 +147,7 @@ const preview: Preview = {
}
}
},

loaders: isChromatic() && document.fonts ? [fontLoader] : []
};

Expand Down
35 changes: 22 additions & 13 deletions packages/core/src/components/Dialog/__stories__/Dialog.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "../__tests__/DialogDataTestIds";
import useSwitch from "../../../hooks/useSwitch";
import "./Dialog.stories.scss";
import { HideShowEvent } from "../../../constants/dialog";

const metaSettings = createStoryMetaSettingsDecorator({
component: Dialog,
Expand All @@ -19,14 +20,30 @@ const metaSettings = createStoryMetaSettingsDecorator({
actionPropsArray: [] // List the component's actions here
});

const showHideArgTypes = {
options: Object.values(HideShowEvent),
control: {
type: "multi-select"
},
table: {
type: {
summary: Object.values(HideShowEvent).join(" | ")
}
}
};

export default {
title: "Popover/Dialog",
component: Dialog,
argTypes: metaSettings.argTypes,
argTypes: {
...metaSettings.argTypes,
hideTrigger: showHideArgTypes,
showTrigger: showHideArgTypes
},
decorators: metaSettings.decorators
};

const dialogTemplate = ({ shouldShowOnMount, position, ...dialogProps }) => {
const dialogTemplate = ({ showTrigger, hideTrigger, shouldShowOnMount = true, position, ...dialogProps }) => {
// for prevent dialog to move while scrolling
const modifiers = [
{
Expand All @@ -40,10 +57,10 @@ const dialogTemplate = ({ shouldShowOnMount, position, ...dialogProps }) => {
<div className="monday-storybook-dialog--story-padding">
<Dialog
modifiers={modifiers}
shouldShowOnMount={shouldShowOnMount || true}
shouldShowOnMount={shouldShowOnMount}
{...dialogProps}
showTrigger={[Dialog.hideShowTriggers.CLICK]}
hideTrigger={[Dialog.hideShowTriggers.CLICK]}
showTrigger={showTrigger || [Dialog.hideShowTriggers.CLICK]}
hideTrigger={hideTrigger || [Dialog.hideShowTriggers.CLICK]}
position={position || Dialog.positions.RIGHT}
content={
<DialogContentContainer>
Expand All @@ -60,14 +77,6 @@ const dialogTemplate = ({ shouldShowOnMount, position, ...dialogProps }) => {
export const Overview = {
render: dialogTemplate.bind({}),

parameters: {
docs: {
source: {
type: "code"
}
}
},

name: "Overview"
};

Expand Down

0 comments on commit 89f750a

Please sign in to comment.