import { ComponentStory, ComponentMeta } from '@storybook/react'; import { useState } from 'react'; import { FragmentReactionType } from './Bubble.types'; import { OnReactionPayload } from './Reaction'; import { Flex, Bubble, Box } from '../../index'; export default { component: Bubble, } as ComponentMeta; export const Default: ComponentStory = () => { return ( {}} /> {}} /> {}} /> {}} /> {}} /> ); }; export const BlockQuote: ComponentStory = () => { return ( {}} /> {}} /> ); }; export const InlineCode: ComponentStory = () => { return ( {}} /> {}} /> ); }; export const Mentions: ComponentStory = () => { return ( {}} /> {}} /> ); }; export const CodeBlock: ComponentStory = () => { return ( {}} /> {}} /> ); }; export const Link: ComponentStory = () => ( {}} /> {}} /> {}} /> ); export const Image: ComponentStory = () => ( {}} /> {}} /> ); export const Reactions: ComponentStory = () => { const [reacts, setReacts] = useState([]); const isOurPatp = '~lomder-librun'; window.ship = isOurPatp; const onReaction = (payload: OnReactionPayload) => { if (payload.action === 'add') { setReacts([ ...reacts, { msgId: '0', by: isOurPatp, emoji: payload.emoji }, ]); } else { const removeIdx = reacts.findIndex( (r) => r.emoji === payload.emoji && r.by === isOurPatp ); if (removeIdx === -1) { return; } setReacts(reacts.filter((_, idx) => idx !== removeIdx)); } }; return ( {}} /> ); }; export const ReplyTo: ComponentStory = () => ( {}} /> {}} /> {}} /> {}} /> ); export const RelicTab: ComponentStory = () => ( {}} /> );