Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the new Figma share URL #240

Merged
merged 5 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-pushes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Check files are formatted with Prettier
run: npx prettier --check README.md CHANGELOG.md CONTRIBUTING.md package.json "packages/**/*.{js,jsx,ts,tsx,md,mdx,json}"
run: npx prettier --check README.md CONTRIBUTING.md package.json "packages/**/*.{js,jsx,ts,tsx,md,mdx,json}"
- name: Check TypeScript typings
run: |
cd packages/storybook-addon-designs
Expand Down
4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
storybook-static
cjs
esm

# Auto generated file
/packages/storybook-addon-designs/CHANGELOG.md
CHANGELOG.md
19 changes: 19 additions & 0 deletions packages/examples/stories/tests/issues/239.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";

import { Button } from "../../Button";

export default {
title: "Tests/Issues/#239",
render() {
return <Button>Button</Button>;
},
};

export const NewURL = {
parameters: {
design: {
type: "figma",
url: "https://www.figma.com/design/Klm6pxIZSaJFiOMX5FpTul9F/storybook-addon-designs-sample?node-id=0%3A1&t=QfPVIRalrysutNxH-1",
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IFrame } from "./IFrame";
import { FigmaConfig, IFrameConfigBase } from "../../config";

export const figmaURLPattern =
/https:\/\/([w.-]+.)?figma.com\/(file|proto)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/;
/https:\/\/[\w.-]+\.?figma.com\/([\w-]+)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/;

export const isFigmaURL = (url: string) => figmaURLPattern.test(url);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const Figspec: FC<Props> = ({ config }) => {
throw new Error(config.url + " is not a valid Figma URL.");
}

const [, , , fileKey] = match;
const [, , fileKey] = match;

const url = new URL(config.url);

Expand Down