Skip to content

Commit 0f70977

Browse files
committed
cleanup
1 parent 81a6ac8 commit 0f70977

File tree

8 files changed

+7
-331
lines changed

8 files changed

+7
-331
lines changed

src/Panel.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/Tab.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/Tool.tsx

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
import React, { memo, useCallback, useEffect, useState } from "react";
2-
import { useGlobals, useParameter, useStorybookApi } from "@storybook/manager-api";
3-
import { Icons, IconButton } from "@storybook/components";
4-
import { ADDON_ID, PARAM_KEY, TOOL_ID } from "./constants";
5-
import { StackBlitzLogo } from "./components/StackBlitzLogo";
1+
import React, { useState, MouseEvent } from "react";
2+
import { useParameter, useStorybookApi } from "@storybook/manager-api";
3+
import { IconButton } from "@storybook/components";
4+
import { PARAM_KEY, TOOL_ID } from "./constants";
65
import CodeflowLogo from "./components/CodeflowLogo";
76

8-
export const Tool = memo(function MyAddonSelector() {
9-
const [globals, updateGlobals] = useGlobals();
7+
export const Tool = function MyAddonSelector() {
108
const githubUrl = useParameter(PARAM_KEY);
119
const api = useStorybookApi();
1210
const [disabled, setDisabled] = useState(false)
1311

14-
// TODO: get the github repository from the settings;
15-
// const githubUrl = `https://github.com/stackblitz/docs`;
16-
1712
const currentStory = api.getCurrentStoryData();
1813

1914
if (!currentStory) {
@@ -27,58 +22,18 @@ export const Tool = memo(function MyAddonSelector() {
2722
setDisabled(false);
2823
}
2924

30-
const { id } = api.getCurrentStoryData();
31-
3225
const stackblitzUrl = `https://pr.new/${githubUrl}`;
3326

34-
// api.on('STORY_CHANGED', () => {
35-
// const { id } = api.getCurrentStoryData();
36-
// // Extract the component name from the story ID.
37-
// componentName = id.split('--')[0];
38-
// });
39-
40-
console.log({disabled});
41-
4227
return (
4328
<IconButton
4429
disabled={disabled}
4530
key={TOOL_ID}
4631
href={stackblitzUrl}
32+
onClick={(e: MouseEvent) => disabled && e.preventDefault()}
4733
target="_blank"
4834
title="Open in StackBlitz and make a pull request"
4935
>
5036
<CodeflowLogo />
5137
</IconButton>
5238
);
53-
});
54-
55-
56-
// addons.register('dynamicLinkButton', api => {
57-
// const renderLinkButton = (componentName) => {
58-
// const url = `https://example.com/${componentName}`;
59-
60-
// const handleClick = () => {
61-
// window.open(url, '_blank');
62-
// };
63-
64-
// const LinkButton = () => (
65-
// <button onClick={handleClick}>Visit "{componentName}"</button>
66-
// );
67-
68-
// const container = document.createElement('div');
69-
// ReactDOM.render(<LinkButton />, container);
70-
// return container;
71-
// };
72-
73-
// let currentComponentName = null;
74-
75-
// api.on(STORY_CHANGED, () => {
76-
// const { id } = api.getCurrentStoryData();
77-
// // Extract the component name from the story ID.
78-
// currentComponentName = id.split('--')[0];
79-
80-
// const element = renderLinkButton(currentComponentName);
81-
// document.getElementById('root').innerHTML = '';
82-
// document.getElementById('root').appendChild(element);
83-
// });
84-
// });
39+
};

src/components/List.tsx

Lines changed: 0 additions & 95 deletions
This file was deleted.

src/components/PanelContent.tsx

Lines changed: 0 additions & 76 deletions
This file was deleted.

src/components/StackBlitzLogo.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/components/TabContent.tsx

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/manager.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { addons, types } from "@storybook/manager-api";
22
import { ADDON_ID, TOOL_ID, PANEL_ID, TAB_ID } from "./constants";
33
import { Tool } from "./Tool";
4-
import { Panel } from "./Panel";
5-
import { Tab } from "./Tab";
64

75
/**
86
* Note: if you want to use JSX in this file, rename it to `manager.tsx`

0 commit comments

Comments
 (0)