chore: storybook

This commit is contained in:
cha0s 2024-06-24 05:00:24 -05:00
parent d5af4aed83
commit 3b08a87f39
3 changed files with 12 additions and 10 deletions

View File

@ -1,6 +1,6 @@
import {useEffect, useRef, useState} from 'react'; import {useEffect, useRef, useState} from 'react';
import Dom from '@/components/dom.jsx'; import Dom from '@/react-components/dom.jsx';
import {RESOLUTION} from '@/constants.js'; import {RESOLUTION} from '@/constants.js';
function Decorator({children, style}) { function Decorator({children, style}) {
@ -26,6 +26,7 @@ function Decorator({children, style}) {
ref={ref} ref={ref}
style={{ style={{
backgroundColor: '#1099bb', backgroundColor: '#1099bb',
flexDirection: 'column',
opacity: 0 === scale ? 0 : 1, opacity: 0 === scale ? 0 : 1,
position: 'relative', position: 'relative',
height: `calc(${RESOLUTION.y}px * ${scale})`, height: `calc(${RESOLUTION.y}px * ${scale})`,

View File

@ -1,14 +1,12 @@
import {useArgs} from '@storybook/preview-api'; import {useArgs} from '@storybook/preview-api';
import {fn} from '@storybook/test'; import {fn} from '@storybook/test';
import Hotbar from '@/components/hotbar.jsx'; import Hotbar from '@/react-components/hotbar.jsx';
import DomDecorator from './dom-decorator.jsx'; import DomDecorator from './dom-decorator.jsx';
import potion from '/assets/potion.png?url';
const slots = Array(10).fill({}); const slots = Array(10).fill({});
slots[2] = {image: potion, qty: 24}; slots[2] = {qty: 24, source: '/assets/potion'};
export default { export default {
title: 'Dom/Inventory/Hotbar', title: 'Dom/Inventory/Hotbar',
@ -25,7 +23,12 @@ export default {
}; };
return Hotbar(); return Hotbar();
}, },
DomDecorator(), DomDecorator({
style: {
display: 'flex',
flexDirection: 'column',
},
}),
], ],
tags: ['autodocs'], tags: ['autodocs'],
args: { args: {

View File

@ -1,9 +1,7 @@
import Slot from '@/components/slot.jsx'; import Slot from '@/react-components/slot.jsx';
import DomDecorator from './dom-decorator.jsx'; import DomDecorator from './dom-decorator.jsx';
import potion from '/assets/potion.png?url';
export default { export default {
title: 'Dom/Inventory/Slot', title: 'Dom/Inventory/Slot',
component: Slot, component: Slot,
@ -33,7 +31,7 @@ export default {
}, },
}, },
args: { args: {
image: potion, source: '/assets/potion',
}, },
}; };