Giter Club home page Giter Club logo

Comments (10)

pocka avatar pocka commented on May 17, 2024 1

🤯

Given the world's movement toward more-privacy-focused-internet, I'll add a section of the third-party cookie stuff to docs.

from addon-designs.

shamilovtim avatar shamilovtim commented on May 17, 2024

Think this is #92. Try moving the token down to the component and removing design:{} from parameters

from addon-designs.

EvgenyOrekhov avatar EvgenyOrekhov commented on May 17, 2024

Tried moving accessToken from .storybook/preview.js to MyComponent.stories.js, it didn't help.

from addon-designs.

shamilovtim avatar shamilovtim commented on May 17, 2024

This helped fix my issues. I noticed you had:

import { withDesign } from 'storybook-addon-designs';

export const parameters = {
  actions: { argTypesRegex: '^on[A-Z].*' },
  controls: { expanded: true },
  decorators: [withDesign],
  design: { accessToken: '<private-access-token>' },
};

Instead I put withDesign on my individual components (not globally set like this)

Working repro is:

export default {
  decorators: [withDesign],
  title: 'Buttons',
  component: PrimaryButton,
}

const Template: Story<unknown> = args => <PrimaryButton {...args} />;

export const Primary = Template.bind({});
Primary.args = {
  text: 'Button',
  type: 'primary',
  onPress: () => null,
  disabled: false,
  isInProgress: false,
  compact: false
};
Primary.parameters = {
  design: {
    url: 'designURL'
  }
};

export const PrimaryDisabled = Template.bind({});
PrimaryDisabled.args = {
  ...Primary.args,
  disabled: true
};
PrimaryDisabled.parameters = {
  design: {
    url: 'designURL'
  }
};

and with this my #92 and #95 were resolved

from addon-designs.

EvgenyOrekhov avatar EvgenyOrekhov commented on May 17, 2024

So it's impossible to set withDesign globally? That's unfortunate. I would rather prefer to have less boilerplate code.

from addon-designs.

shamilovtim avatar shamilovtim commented on May 17, 2024

You only have to set it on the default stories, so it's not too bad IMO

from addon-designs.

EvgenyOrekhov avatar EvgenyOrekhov commented on May 17, 2024

I just tried this:

.storybook/preview.js

export const parameters = {
  actions: { argTypesRegex: '^on[A-Z].*' },
  controls: { expanded: true },
};

MyComponent.stories.js

import { withDesign } from 'storybook-addon-designs';

export default {
  title: 'MyComponent',
  decorators: [withDesign],
  argTypes: {
    // ...
  },
};

// ...

export const MyComponent = Template.bind({});

MyComponent.parameters = {
  design: {
    type: 'figma',
    url: 'https://www.figma.com/file/...',
    accessToken: '<private-access-token>',
  },
};

It did not help.

from addon-designs.

pocka avatar pocka commented on May 17, 2024

At first, this is nothing related to #92, as this issue is for type: "figma" and the Figma Live Embed Kit is loaded successfully. Also, the accessToken property is for type: "experimental-figspec", not type: "figma". Only type and url are required properties even if your file is private as loaded iframe takes care of the authentication process.


These errors are results of Figma Live Embed Kit (= scripts inside <iframe>) calling their internal(?) API and the API returns HTTP 401. From my experience, this is probably due to their API outage or session problem. If the latter, clearing cache/using private browsing/using a different browser would solve the problem.

If you believe the cause is at the addon instead of at the loaded iframe content, please provide an actual and expected behavior, not just errors.

from addon-designs.

EvgenyOrekhov avatar EvgenyOrekhov commented on May 17, 2024

At first, this is nothing related to #92, as this issue is for type: "figma" and the Figma Live Embed Kit is loaded successfully. Also, the accessToken property is for type: "experimental-figspec", not type: "figma". Only type and url are required properties even if your file is private as loaded iframe takes care of the authentication process.

That is very valuable information! It was not clear when I was reading the docs. I would appreciate it if you could add this information to the docs.


I figured it out. The 401 errors and the infinite loop were caused by the fact that I have the "Block third-party cookies" feature enabled in Google Chrome:

image

I added my Storybook host to exceptions and now it works:

image

Thank you!

from addon-designs.

judithrocketmakers avatar judithrocketmakers commented on May 17, 2024

Worth noting that this doesn't work with Safari still, but that's because Safari has a bit of an all or nothing approach to privacy so it's the browser not the plugin.

from addon-designs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.