Skip to content
1 change: 1 addition & 0 deletions .storybook/next-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const ns = [
"glossary-tooltip",
"learn-quizzes",
"page-about",
"page-assets",
"page-index",
"page-learn",
"page-upgrades",
Expand Down
38 changes: 38 additions & 0 deletions src/components/AssetDownload/AssetDownload.stories.tsx
Original file line number Diff line number Diff line change
@@ -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<typeof AssetDownload>

export default meta

type Story = StoryObj<typeof meta>

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",
},
}
6 changes: 4 additions & 2 deletions src/lib/utils/relativePath.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down