Skip to content

Commit

Permalink
refactor: Storybook Config to make absolute paths work
Browse files Browse the repository at this point in the history
  • Loading branch information
FAUSTMANNSTEF committed Dec 19, 2024
1 parent c1debc0 commit 71c325e
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 56 deletions.
13 changes: 13 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { StorybookConfig } from "@storybook/react-webpack5";
import path from "path";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
Expand All @@ -21,5 +22,17 @@ const config: StorybookConfig = {
autodocs: true,
},
staticDirs: ["../public"],

webpackFinal: async (config) => {
if (config.resolve) {
config.resolve.alias = {
...config.resolve.alias,
theme: path.resolve(__dirname, "../src/theme"),
assets: path.resolve(__dirname, "../src/assets"),
app: path.resolve(__dirname, "../src/app"),
};
}
return config;
},
};
export default config;
7 changes: 1 addition & 6 deletions src/components/Buttons/ZDSButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react";
import { fn } from "@storybook/test";
<<<<<<< Updated upstream:src/components/Buttons/ZDSButton.stories.tsx
import Button from "./ZDSButton";
import { ReactComponent as GoogleIcon } from "../../assets/AIDA/vectors/HeaderSignInViewGoogle.svg";
=======
import Button from "./myButton";
import { ReactComponent as GoogleIcon } from "assets/vectors/jsx/HeaderSignInViewGoogle.svg";
>>>>>>> Stashed changes:src/components/Buttons/myButton.stories.tsx
import { ReactComponent as GoogleIcon } from "assets/AIDA/vectors/HeaderSignInViewGoogle.svg";
import ExpandMore from "@mui/icons-material/ExpandMore";
import ExpandLess from "@mui/icons-material/ExpandLess";
import colors from "../../theme/colors";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
<<<<<<< Updated upstream:src/components/Buttons/cta-common-btn/ZDSAidaCtaCommonBtn.stories.tsx
import { ExplorerLargeCtaIcon } from "../../../assets/AIDA/jsx/ExplorerLargeCtaIcon";

import { ExplorerLargeCtaIcon } from "assets/AIDA/jsx/ExplorerLargeCtaIcon";
import { ZDSAidaCtaCommonBtn } from ".";
=======
import { ExplorerLargeCtaIcon } from "assets/vectors/jsx/ExplorerLargeCtaIcon";
import { CtaCommonBtn } from ".";
>>>>>>> Stashed changes:src/components/buttons/cta-common-btn/CtaCommonBtn.stories.tsx
import { withRouter } from "storybook-addon-remix-react-router";

const meta = {
Expand Down
10 changes: 0 additions & 10 deletions src/components/Grids/ZDSGrantCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
<<<<<<< Updated upstream:src/components/Grids/ZDSGrantCard.stories.tsx
// import { withRouter } from "storybook-addon-remix-react-router";
import { ZDSGrantCard } from "./ZDSGrantCard";

const meta = {
title: "Example/Grid",
component: ZDSGrantCard,
// decorators: [withRouter],
=======
import { GrantCard } from "./GrantCard";

const meta = {
title: "Example/Grid",
component: GrantCard,
>>>>>>> Stashed changes:src/components/grids/GrantCard.stories.tsx
parameters: {
layout: "fullscreen",
},
Expand Down
4 changes: 0 additions & 4 deletions src/components/Grids/ZDSGrantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import Box from "@mui/material/Box";
import Divider from "@mui/material/Divider";
import Typography from "@mui/material/Typography";
import LocationIcon from "@mui/icons-material/LocationOn";
<<<<<<< Updated upstream:src/components/Grids/ZDSGrantCard.tsx
import { GrantCardProps } from "./data"; // Ensure this path is correct and the file exists
=======
import { GrantCardProps } from "./data";
>>>>>>> Stashed changes:src/components/grids/GrantCard.tsx

export const ZDSGrantCard: React.FC<GrantCardProps> = (
props: GrantCardProps
Expand Down
5 changes: 0 additions & 5 deletions src/components/Menu/MuiMenu/ZDSDropdown.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
<<<<<<< Updated upstream:src/components/Menu/MuiMenu/ZDSDropdown.stories.tsx
import MyDropdown from "./ZDSDropdown";
import { colors } from "../../../theme";
=======
import MyDropdown from "./myDropdown";
import { colors } from "theme";
>>>>>>> Stashed changes:src/components/Menu/MuiMenu/mydropdown.stories.tsx
import IconButton from "@mui/material/IconButton";
import MenuRounded from "@mui/icons-material/MenuRounded";
import AccountCircleIcon from "@mui/icons-material/AccountCircle";
Expand Down
6 changes: 0 additions & 6 deletions src/components/SearchInput/ZDSSearchInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
<<<<<<< Updated upstream:src/components/SearchInput/ZDSSearchInput.stories.tsx
import { ZDSSearchInput } from "./ZDSSearchInput";
import { ReactComponent as ExplorerSearchIcon } from "../../assets/OpenAid/vectors/ExplorerSearchIcon.svg";
import colors from "../../theme/colorsSeaerchInput";
=======
import { mySearchInput } from "./mySearchInput";
import { ReactComponent as ExplorerSearchIcon } from "assets/vectors/ExplorerSearchIcon.svg";
import colors from "theme/colorsSeaerchInput";
>>>>>>> Stashed changes:src/components/SearchInput/mySearchInput.stories.tsx
import { Box } from "@mui/material";
import SearchIcon from "@mui/icons-material/Search";
import ClearIcon from "@mui/icons-material/Clear";
Expand Down
13 changes: 1 addition & 12 deletions src/components/Tables/TabulatorTables/data.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
<<<<<<< Updated upstream
import { appColors } from "./../../../app/theme/index";
import { formatLocale } from "./../../../app/utils/formatLocale";
import {
CellComponent,
ColumnDefinition,
TabulatorFull as Tabulator,
} from "tabulator-tables";
import { TableDataItem } from "./ZDSTabulatorTable";
=======
import { appColors } from "app/theme/index";
import { formatLocale } from "app/utils/formatLocale";
import { CellComponent } from "tabulator-tables";
import { ColumnDefinition } from "tabulator-tables";
import { TabulatorFull as Tabulator } from "tabulator-tables";
import { TableDataItem } from "./myTabulatorTable";
>>>>>>> Stashed changes
import { TableDataItem } from "./ZDSTabulatorTable";

export const TABULATOR_BORDER_STYLES = {
BLUE: "2px solid blue",
Expand Down
7 changes: 1 addition & 6 deletions src/components/buttons/cta-common-btn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ import { useNavigate } from "react-router-dom";
import ButtonBase from "@mui/material/ButtonBase";
import Typography from "@mui/material/Typography";
import ArrowOutward from "@mui/icons-material/ArrowOutward";
<<<<<<< Updated upstream
import { CtaCommonBtnProps, ZDSAidaCtaCommonBtnVariantStyles } from "./data";
import { Color } from "@mui/material";
=======
import { CtaCommonBtnVariantStyles } from "./data";
import { ZDSAidaCtaCommonBtnVariantStyles } from "./data";
import { CtaCommonBtnProps } from "./data";
>>>>>>> Stashed changes

export const ZDSAidaCtaCommonBtn: React.FC<CtaCommonBtnProps> = (
props: CtaCommonBtnProps
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"outDir": "dist",
"declarationDir": "dist/types",
"baseUrl": "./src",
"paths": {
"theme/*": ["theme/*"]
},
"lib": [
"dom",
"dom.iterable",
Expand Down

0 comments on commit 71c325e

Please sign in to comment.