Skip to content

Commit c991ce1

Browse files
I9527 storybook6 (#311)
* pkp/pkp-lib#i9527 Add Dialog to storybook, document useDialog and refine styling * pkp/pkp-lib#9527 Documenting SideModal * pkp/pkp-lib#9527 Set default dir in storybook * pkp/pkp-lib#9527 Interactive tests to snapshot correctly SideModals * pkp/pkp-lib#9527 Also automatically open dialogs for snapshotting * pkp/pkp-lib#9527 Update viewports for long modals * pkp/pkp-lib#9527 Adjust viewports, mock date for SelectReviewerListPanel * pkp/pkp-lib#9527 Better date mocking on story level * pkp/pkp-lib#9527 Refine modals snapshots
1 parent ed8ce9d commit c991ce1

30 files changed

+1162
-393
lines changed

.storybook/modes.js

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export const allModes = {
99
},
1010
// for snapshotting scrollable areas with all content, like modals
1111
desktopLargeHeight: {
12+
theme: 'ltr',
13+
viewport: 'largeHeight',
14+
},
15+
'desktopLargeHeight rtl': {
1216
viewport: 'largeHeight',
17+
theme: 'rtl',
1318
},
1419
};

.storybook/preview.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/** @type { import('@storybook/vue3').Preview } */
22

33
import {withThemeByDataAttribute} from '@storybook/addon-themes';
4+
import {mockDateDecorator} from 'storybook-mock-date-decorator';
5+
46
import {setup} from '@storybook/vue3';
57
import GlobalMixins from '@/mixins/global.js';
68
import emitter from 'tiny-emitter/instance';
@@ -21,7 +23,6 @@ import Tabs from '@/components/Tabs/Tabs.vue';
2123
import FloatingVue from 'floating-vue';
2224

2325
import PkpDialog from '@/components/Modal/Dialog.vue';
24-
import {useDialogStore} from '@/stores/dialogStore';
2526

2627
import VueScrollTo from 'vue-scrollto';
2728

@@ -106,7 +107,7 @@ const preview = {
106107
* is too late fort tinyMCE which needs to detect it on first render correctly
107108
*
108109
*/
109-
document.body.setAttribute('dir', globals.theme);
110+
document.body.setAttribute('dir', globals.theme || 'ltr');
110111
return story();
111112
},
112113
(story) => ({
@@ -115,22 +116,18 @@ const preview = {
115116
}),
116117
/** Globally Available Dialog */
117118
(story) => ({
118-
setup() {
119-
const dialogStore = useDialogStore();
120-
return {dialogStore};
121-
},
119+
setup() {},
122120
components: {story, PkpDialog},
123121
template: `<div>
124-
<PkpDialog
125-
:open="dialogStore.dialogOpened"
126-
v-bind="dialogStore.dialogProps"
127-
@close="dialogStore.closeDialog"
128-
></PkpDialog>
122+
<PkpDialog></PkpDialog>
129123
<story />
130124
</div>`,
131125
}),
126+
mockDateDecorator,
132127
],
133128
parameters: {
129+
// remove default storybook padding as it likely cuts off modals
130+
layout: 'fullscreen',
134131
actions: {argTypesRegex: '^on[A-Z].*'},
135132
controls: {
136133
expanded: true,
@@ -159,7 +156,7 @@ const preview = {
159156
/** For scrollable scenarios */
160157
largeHeight: {
161158
name: 'Large',
162-
styles: {width: '1024px', height: '1500px'},
159+
styles: {width: '1280px', height: '1600px'},
163160
},
164161
},
165162
},

0 commit comments

Comments
 (0)