Skip to content

docs: improve storybook for embedding #29

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

Closed
wants to merge 1 commit into from
Closed
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 .storybook/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import "./page.css";

<Canvas/>

<Controls/>
{ new URL(window.location.href).searchParams.has("hideControls") ? null :<Controls/> }

<Stories includePrimary={false}/>
10 changes: 10 additions & 0 deletions src/stories/drive-picker.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ const elementEventNames = getElementEvents("drive-picker").map(
(event) => event.name,
);

const searchParams = new URL(location.href).searchParams;
const argsAllowedFromParams = [
...Object.keys(elementArgTypes["drive-picker"]),
...Object.keys(elementArgTypes["drive-picker-docs-view"]),
];
const argValuesFromParams = Object.fromEntries(
argsAllowedFromParams.map((arg) => [arg, searchParams.get(arg) || undefined]),
);

const meta: Meta = {
component: "drive-picker",
argTypes: {
...elementArgTypes["drive-picker"],
...elementArgTypes["drive-picker-docs-view"],
},
args: {
...argValuesFromParams,
"app-id": APP_ID,
"client-id": CLIENT_ID,
},
Expand Down
2 changes: 1 addition & 1 deletion src/stories/utils/lazy-preview-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ lazy-preview button:hover {
this.appendChild(style);

const button = document.createElement("button");
button.textContent = "Preview";
button.textContent = "Open Drive Picker";
this.appendChild(button);

button.addEventListener("click", () => {
Expand Down
Loading