Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: logocloud #961

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/components/src/interfaces/complex/LogoCloud.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Static } from "@sinclair/typebox"
import { Type } from "@sinclair/typebox"

import type { IsomerSiteProps } from "~/types"
import { AltTextSchema, ImageSrcSchema } from "./Image"

export const LOGO_CLOUD_TYPE = "logocloud"
Expand All @@ -25,10 +26,10 @@ export const LogoCloudSchema = Type.Object(
}),
},
{
title: "Title",
title: "Logocloud component",
},
)

export type LogoCloudProps = Static<typeof LogoCloudSchema> & {
assetsBaseUrl?: string
site: IsomerSiteProps
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react"

import type { IsomerSiteProps } from "~/types"
import { LogoCloud } from "./LogoCloud"

const meta: Meta<typeof LogoCloud> = {
Expand All @@ -24,17 +25,44 @@ const VERTICAL_IMAGE = {
src: "https://placehold.co/100x1000",
alt: "placeholder",
}
const site: IsomerSiteProps = {
siteName: "Isomer Next",
siteMap: {
id: "1",
title: "Home",
permalink: "/",
lastModified: "",
layout: "homepage",
summary: "",
},
theme: "isomer-next",
isGovernment: true,
logoUrl: "https://www.isomer.gov.sg/images/isomer-logo.svg",
navBarItems: [],
footerItems: {
privacyStatementLink: "https://www.isomer.gov.sg/privacy",
termsOfUseLink: "https://www.isomer.gov.sg/terms",
siteNavItems: [],
},
lastUpdated: "1 Jan 2021",
search: {
type: "searchSG",
clientId: "",
},
}

// Default scenario
export const Default: Story = {
args: {
images: [IMAGE],
site,
},
}

export const ManyImages: Story = {
args: {
images: Array(10).fill(IMAGE),
site,
},
}

Expand All @@ -54,17 +82,20 @@ export const Agency: Story = {
src: "https://www.ncss.gov.sg/images/default-source/asset/celebrating-volunteers-logo.png?sfvrsn=44b85185_2 ",
},
],
site,
},
}

export const HugeHorizontalLogo: Story = {
args: {
images: [...Array(4).fill(IMAGE), HORIZONTAL_IMAGE],
site,
},
}

export const HugeVerticalLogo: Story = {
args: {
images: [...Array(4).fill(IMAGE), VERTICAL_IMAGE],
site,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ImageClient } from "../Image"
export const LogoCloud = ({
images: baseImages,
title,
assetsBaseUrl,
site: { assetsBaseUrl },
}: LogoCloudProps) => {
const images = baseImages.map(({ src, alt }) => {
const transformedSrc =
Expand Down
Loading