diff --git a/.storybook/next-intl.ts b/.storybook/next-intl.ts index a28a2bdad7c..7e793fde433 100644 --- a/.storybook/next-intl.ts +++ b/.storybook/next-intl.ts @@ -13,6 +13,7 @@ export const ns = [ "glossary-tooltip", "learn-quizzes", "page-about", + "page-assets", "page-index", "page-learn", "page-upgrades", diff --git a/src/components/AssetDownload/AssetDownload.stories.tsx b/src/components/AssetDownload/AssetDownload.stories.tsx new file mode 100644 index 00000000000..3ed6d86ed79 --- /dev/null +++ b/src/components/AssetDownload/AssetDownload.stories.tsx @@ -0,0 +1,38 @@ +import type { Meta, StoryObj } from "@storybook/react" + +import AssetDownload from "." + +import ethDiamondBlack from "@/public/images/assets/eth-diamond-black.png" +import hero from "@/public/images/home/hero.png" + +const meta = { + title: "Molecules / Display Content / AssetDownload", + component: AssetDownload, + parameters: { + layout: "centered", + }, + tags: ["autodocs"], +} satisfies Meta + +export default meta + +type Story = StoryObj + +export const WithArtist: Story = { + args: { + title: "Ethereum hero", + alt: "Ethereum hero", + image: hero, + artistName: "Liam Cobb", + artistUrl: "https://liamcobb.com/", + }, +} + +export const BrandAsset: Story = { + args: { + title: "ETH Diamond Glyph", + alt: "ETH Diamond Glyph", + image: ethDiamondBlack, + svgUrl: "/images/assets/svgs/eth-diamond-glyph.svg", + }, +} diff --git a/src/lib/utils/relativePath.ts b/src/lib/utils/relativePath.ts index 6a0da471475..9cd1aa17a7f 100644 --- a/src/lib/utils/relativePath.ts +++ b/src/lib/utils/relativePath.ts @@ -1,7 +1,9 @@ import { join } from "path" -export const getRelativePath = (routerPath: string, fileName: string) => - join("content", routerPath, fileName) +export const getRelativePath = ( + routerPath: string | undefined, + fileName: string +) => join("content", routerPath || "", fileName) /** * Replaces back slashes of file paths generated in Windows OS with Node to forward slashes.