figspec-react

React binding for Figspec web components

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
import { action } from "@storybook/addon-actions";

import { html } from "lit-html";

import demoJson from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/file.json";
import image2_5 from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/2:5.svg";
import image2_9 from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/2:9.svg";
import image2_13 from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/2:13.svg";
import image64_1 from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/64:1.svg";
import image93_14 from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/93:14.svg";
import image93_32 from "../__storybook__/demo-data/Klm6pxIZSaJFiOMX5FpTul9F/93:32.svg";

export default {
  title: "Components/figspec-file-viewer",
  component: "figspec-file-viewer",
  parameters: {
    layout: "fullscreen",
    docs: {
      inlineStories: false,
      iframeHeight: 600,
    },
  },
};

const Template = (args) => html`
  <figspec-file-viewer
    style="
      min-width: 100%;
      min-height: 100vh;
      font-family: sans-serif;
    "
    .documentNode=${args.documentNode}
    .renderedImages=${args.renderedImages || {}}
    .panSpeed=${args.panSpeed || 500}
    .zoomSpeed=${args.zoomSpeed || 500}
    zoom-margin=${args.zoomMargin || 50}
    link=${args.link || "https://figma.com"}
  ></figspec-file-viewer>
`;

export const Defaults = Template.bind({});
Defaults.args = {
  documentNode: demoJson,
  renderedImages: {
    "2:5": image2_5,
    "2:9": image2_9,
    "2:13": image2_13,
    "64:1": image64_1,
    "93:14": image93_14,
    "93:32": image93_32,
  },
};