import type { Meta, StoryObj } from '@storybook/react'; import React from 'react'; import { MapViewControl } from './map-view-control'; const views = [ { id: 'rs', label: 'Estado', center: { lat: -30.03, lng: -51.23 }, zoom: 7 }, { id: 'metro', label: 'Região metropolitana', center: { lat: -29.99, lng: -51.15 }, zoom: 10 }, { id: 'capital', label: 'Capital', center: { lat: -30.03, lng: -51.23 }, zoom: 12 }, ]; const meta: Meta = { title: 'UI/MapViewControl', component: MapViewControl, parameters: { layout: 'centered', }, argTypes: { variant: { control: 'inline-radio', options: ['inline', 'overlay'] }, }, }; export default meta; type Story = StoryObj; function ControlledExample(args: React.ComponentProps) { const [activeViewId, setActiveViewId] = React.useState('rs'); return (

Camera would move to: {views.find(v => v.id === activeViewId)?.label}

); } /** Switching between named camera positions. */ export const Default: Story = { args: { views }, render: args => , }; /** With the reframe action, which re-fits the camera around the current data. */ export const WithRefit: Story = { args: { views, onRefit: () => {}, }, render: args => , }; /** Floating over a map, inside a `relative` container. */ export const Overlay: Story = { args: { views, variant: 'overlay', position: 'top-left', onRefit: () => {}, }, render: args => { const [activeViewId, setActiveViewId] = React.useState('rs'); return (
); }, };