import { ComponentStory, ComponentMeta } from '@storybook/react'; import { Flex } from '../../general/Flex/Flex'; import { Text } from '../../general/Text/Text'; import { AppGroup } from './AppGroup'; import { Notification } from './Notification'; export default { component: Notification, } as ComponentMeta; const containerWidth = 400; export const Base: ComponentStory = () => ( <> no image console.log('dismissed')} onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } /> w/ image console.log('dismissed')} onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } /> w/ app console.log('dismissed')} onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } /> w/ app & buttons console.log('dismissed')} onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } /> link click console.log('dismissed')} onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } /> ); export const GroupedByApp: ComponentStory = () => { const chatModel: any = { '/realm-chat/0': { id: 0, title: 'Based chat', description: 'A chat for based people', members: ['~zod', '~nus', '~tasfyn'], image: 'https://www.memeatlas.com/images/pepes/pepe-bit-art-face-profile-picture.png', }, '/realm-chat/1': { id: 0, title: 'Holium chat', description: 'A chat for based people', members: ['~zod', '~nus', '~tasfyn'], image: 'https://pbs.twimg.com/profile_images/1621630320796745729/H5wKemm1_400x400.jpg', }, }; return ( <> No path grouping console.log(`dismissed - ${id}`)} onDismissAll={(app, path) => console.log(`dismissed all ${app} ${path}`) } onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } onPathLookup={(app, path) => { console.log(`path lookup - ${app} ${path}`); return chatModel[path]; }} containerWidth={containerWidth} notifications={[ { id: 1, app: 'realm-chat', path: '/realm-chat/0', title: 'Based chat', content: 'DrunkPlato - Where’s the flamethrower?', type: 'message', read: true, readAt: null, dismissed: false, dismissedAt: null, metadata: JSON.stringify(chatModel['/realm-chat/0']), createdAt: 1679433073, updatedAt: new Date().getTime(), }, { id: 1, app: 'realm-chat', path: '/realm-chat/0', title: 'Based chat', content: 'dimwit-codder - What do you think of my code?', type: 'message', read: true, readAt: null, dismissed: false, metadata: JSON.stringify(chatModel['/realm-chat/0']), dismissedAt: null, createdAt: 1679423073, updatedAt: new Date().getTime(), }, { id: 1, app: 'realm-chat', path: '/realm-chat/1', title: 'Holium chat', content: 'AidenSolaran - Looking at your PR.', type: 'message', read: true, readAt: null, dismissed: false, metadata: JSON.stringify(chatModel['/realm-chat/1']), dismissedAt: null, createdAt: 1679333073, updatedAt: new Date().getTime(), }, ]} /> With path grouping console.log(`dismissed - ${id}`)} onDismissAll={(app, path) => console.log(`dismissed all ${app} ${path}`) } onPathLookup={(app, path) => { console.log(`path lookup - ${app} ${path}`); return chatModel[path]; }} onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } containerWidth={containerWidth} notifications={[ { id: 1, app: 'realm-chat', path: '/realm-chat/0', title: 'DrunkPlato', content: 'Where’s the flamethrower?', type: 'message', read: true, readAt: null, dismissed: false, dismissedAt: null, pathMetadata: JSON.stringify(chatModel['/realm-chat/0']), createdAt: 1679433073, updatedAt: new Date().getTime(), }, { id: 1, app: 'realm-chat', path: '/realm-chat/0', title: 'dimwit-codder', content: 'What do you think of my code?', type: 'message', read: true, readAt: null, dismissed: false, pathMetadata: JSON.stringify(chatModel['/realm-chat/0']), dismissedAt: null, createdAt: 1679423073, updatedAt: new Date().getTime(), }, { id: 1, app: 'realm-chat', path: '/realm-chat/1', title: 'AidenSolaran', content: 'Looking at your PR.', type: 'message', read: true, readAt: null, dismissed: false, pathMetadata: JSON.stringify(chatModel['/realm-chat/1']), dismissedAt: null, createdAt: 1679333073, updatedAt: new Date().getTime(), }, ]} /> ); }; export const GroupedByPath: ComponentStory = () => { const chatModel: any = { '/realm-chat/0': { id: 0, title: 'Based chat', description: 'A chat for based people', members: ['~zod', '~nus', '~tasfyn'], image: 'https://www.memeatlas.com/images/pepes/pepe-bit-art-face-profile-picture.png', }, '/realm-chat/1': { id: 0, title: 'Holium chat', description: 'A chat for based people', members: ['~zod', '~nus', '~tasfyn'], image: 'https://pbs.twimg.com/profile_images/1621630320796745729/H5wKemm1_400x400.jpg', }, }; return ( <> { console.log(`path lookup - ${app} ${path}`); return chatModel[path]; }} groupByPath onDismiss={(id) => console.log(`dismissed - ${id}`)} onDismissAll={(app, path) => console.log(`dismissed all ${app} ${path}`) } onLinkClick={(app, path, link) => console.log(`clicked - ${app} ${path} ${link}`) } containerWidth={containerWidth} notifications={[ { id: 1, app: 'realm-chat', path: '/realm-chat/0', title: 'DrunkPlato', content: 'Where’s the flamethrower?', type: 'message', read: true, readAt: null, dismissed: false, dismissedAt: null, pathMetadata: JSON.stringify(chatModel['/realm-chat/0']), createdAt: 1679433073, updatedAt: new Date().getTime(), }, { id: 1, app: 'realm-chat', path: '/realm-chat/0', title: 'dimwit-codder', content: 'What do you think of my code?', type: 'message', read: true, readAt: null, dismissed: false, pathMetadata: JSON.stringify(chatModel['/realm-chat/0']), dismissedAt: null, createdAt: 1679423073, updatedAt: new Date().getTime(), }, { id: 1, app: 'realm-chat', path: '/realm-chat/1', title: 'AidenSolaran', content: 'Looking at your PR.', type: 'message', read: true, readAt: null, dismissed: false, pathMetadata: JSON.stringify(chatModel['/realm-chat/1']), dismissedAt: null, createdAt: 1679333073, updatedAt: new Date().getTime(), }, ]} /> ); };