Skip to content

Instantly share code, notes, and snippets.

@andrewluetgers
andrewluetgers / PresentInteraction.jsx
Last active January 23, 2024 19:17
Presentation mode for Storybook play functions
import {useEffect} from 'react'
import {fireEvent, within} from '@storybook/testing-library'
import userEvent from '@testing-library/user-event'
export const presentInteraction = storyFn => {
return (
<div>
<PresentInteraction/>
{storyFn()}
@andrewluetgers
andrewluetgers / RuleBuilder.stories.jsx
Last active December 18, 2021 19:48
A pile of code that captures the core of a system to mock out apis that can be used in msw or in express. A standard crud api generator is implemented for the client that uses reactQuery.
import {mswMocks as ruleMocks, getRulesBody} from '../../../api/rules/rulesMocks'
import {mswMocks as rulesetMocks, getRulesetsBody} from '../../../api/rulesets/rulesetsMocks'
import {mswMocks as channelMocks} from '../../../api/channels/channelMocks'
import RuleBuilder from './RuleBuilder'
// -------------------------------------- setup ----------------------------------------
let items = getRulesetsBody,
item = items[0],
{name, uuid} = item || {},
<div css={styles}>
<div class="panel flex-container">
<div class="header">fixed</div>
<div class="content flex-container non-scrollable">
<div class="flex-container non-scrollable">
expands..
<div class="list scrollable">
scrolls...