import type { Meta, StoryFn } from '@storybook/react'; import React, { forwardRef, useRef } from 'react'; import { BasePopup, TBasePopupAnchorRenderer } from '.'; type TComponent = typeof BasePopup; const meta: Meta = { title: 'Popups/BasePopup', component: BasePopup, tags: ['autodocs'], args: {}, }; export default meta; const Template: StoryFn = ({ children, anchor: anchorProp, ...props }) => { const containerRef = useRef(null); return (
Show popup ) } style={{ backgroundColor: '#333', color: '#fff', width: '100vw', textAlign: 'center', }} > lorem ipsum
); }; export const Default = Template.bind({}); Default.args = { gap: 10, viewportGap: 5, }; const AnchorRenderer: TBasePopupAnchorRenderer = forwardRef( ({ activate, deactivate, isActive }, forwardedRef) => ( ), ); AnchorRenderer.displayName = 'AnchorRenderer'; export const WithCustomAnchor = Template.bind({}); WithCustomAnchor.args = { anchor: null, renderAnchor: AnchorRenderer, }; export const WithLifetine = Template.bind({}); WithLifetine.args = { lifetime: 3000, };