Skip to content

Commit 8eadf60

Browse files
Feat: Add Favicon and addon for Core Page redirection
1 parent 7914b8c commit 8eadf60

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

Diff for: .storybook/SBUrlCore.tsx

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ArrowUpRight } from "lucide-react";
2+
import { IconButton } from "@storybook/components";
3+
import { addons, types } from "@storybook/manager-api";
4+
import React from "react";
5+
6+
addons.register("storybook/redirect", () => {
7+
addons.add("storybook/redirect", {
8+
title: "Go to Core Components",
9+
type: types.TOOL,
10+
match: ({ viewMode }) => !!viewMode?.match(/^(story|docs)$/),
11+
render: () => (
12+
<IconButton
13+
key="redirect"
14+
title="Navigate to Core Components"
15+
onClick={async () =>
16+
window.open("https://core.thecodebit.digital", "_blank")
17+
}
18+
style={{
19+
position: "absolute",
20+
right: "30px",
21+
}}
22+
>
23+
Go to Core Components
24+
<ArrowUpRight
25+
style={{ color: "white", width: "0.75em", height: "0.75em" }}
26+
/>
27+
</IconButton>
28+
),
29+
});
30+
});

Diff for: .storybook/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ const config: StorybookConfig = {
1919
},
2020
],
2121
framework: { name: "@storybook/react-webpack5", options: {} },
22+
23+
staticDirs: ["../src/assets/images"],
2224
};
2325
export default config;

Diff for: .storybook/manager.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "./SBThemeToggler";
2+
import "./SBUrlCore";
23
import { addons } from "@storybook/manager-api";
34
import darkTheme from "./darkTheme";
45
import lightTheme from "./lightTheme";

Diff for: webpack.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ module.exports = (_, argv) => ({
8686
"react-dom": { singleton: true, requiredVersion: deps["react-dom"] },
8787
},
8888
}),
89-
new HtmlWebPackPlugin({ template: "./src/index.html" }),
89+
new HtmlWebPackPlugin({
90+
template: "./src/index.html",
91+
favicon: "./src/assets/images/favicon.ico",
92+
}),
9093
new Dotenv(),
9194
],
9295
});

0 commit comments

Comments
 (0)