All files / web/src/components/tutorial AbacusTest.stories.tsx

0% Statements 0/68
0% Branches 0/1
0% Functions 0/1
0% Lines 0/68

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69                                                                                                                                         
import { AbacusReact } from '@soroban/abacus-react'
import type { Meta, StoryObj } from '@storybook/react'

// Test AbacusReact in isolation
function AbacusTestComponent() {
  return (
    <div style={{ padding: '20px' }}>
      <h2>AbacusReact Test</h2>
      <AbacusReact
        value={0}
        interactive={true}
        animated={false}
        scaleFactor={1.5}
        colorScheme="place-value"
        onValueChange={(value) => console.log('Value changed:', value)}
        callbacks={{
          onBeadClick: (beadInfo: unknown) => console.log('Bead clicked:', beadInfo),
        }}
      />
    </div>
  )
}

const meta: Meta<typeof AbacusTestComponent> = {
  title: 'Debug/AbacusTest',
  component: AbacusTestComponent,
  parameters: {
    docs: {
      description: {
        component: 'Test AbacusReact component in isolation to see if it causes the c.some error',
      },
    },
  },
}

export default meta
type Story = StoryObj<typeof AbacusTestComponent>

export const BasicAbacus: Story = {}

export const AbacusWithHighlights: Story = {
  render: () => (
    <div style={{ padding: '20px' }}>
      <h2>AbacusReact with Highlights</h2>
      <AbacusReact
        value={3}
        interactive={true}
        animated={false}
        scaleFactor={1.5}
        colorScheme="place-value"
        highlightBeads={[{ columnIndex: 4, beadType: 'earth', position: 0 }]}
        customStyles={{
          beads: {
            0: {
              earth: {
                0: { fill: '#fbbf24', stroke: '#f59e0b', strokeWidth: 3 },
              },
            },
          },
        }}
        onValueChange={(value) => console.log('Value changed:', value)}
        callbacks={{
          onBeadClick: (beadInfo: unknown) => console.log('Bead clicked:', beadInfo),
        }}
      />
    </div>
  ),
}