@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
33 lines • 1.22 kB
JavaScript
import React, { useState } from "react";
import { GeographySwitcher } from "./GeographySwitcher.js";
import Translator from "./i18n/TranslatorAsync.js";
import { createReportDecorator } from "./storybook/ReportDecorator.js";
export default {
component: GeographySwitcher,
title: "Components/GeographySwitcher",
decorators: [createReportDecorator()],
};
const testGeogs = [
{
geographyId: "geography1",
datasourceId: "ds1",
display: "Geography 1",
precalc: true,
},
{
geographyId: "geography2",
datasourceId: "ds2",
display: "Geography 2",
precalc: true,
},
];
// Wrap in Translator to allow translations to work in storybook without report client
export const geographySwitcher = () => {
const [curGeographyId, setCurGeographyId] = useState("test2");
return (React.createElement(Translator, null,
React.createElement(GeographySwitcher, { geographies: testGeogs, curGeographyId: curGeographyId, changeGeography: (e) => {
console.log(`You selected ${e.target.value}`);
setCurGeographyId(e.target.value);
} })));
};
//# sourceMappingURL=GeographySwitcher.stories.js.map