import type { Meta, StoryObj } from '@storybook/vue3-vite' import CpAirlineLogo from '@/components/CpAirlineLogo.vue' import { docCellStyle, docLabelStyle, docRowWrapStyle } from '@/stories/documentationStyles' const airlineSizes = [16, 24, 32, 48] as const const meta = { title: 'Atoms/CpAirlineLogo', component: CpAirlineLogo, parameters: { docs: { description: { component: 'Displays an airline logo fetched from the Kiwi.com CDN using its IATA code. Falls back to a placeholder when the code is unknown.', }, }, }, argTypes: { iataCode: { control: 'text', description: 'The IATA airline code (e.g. "LH" for Lufthansa, "BA" for British Airways)', table: { type: { summary: 'string' }, defaultValue: { summary: '1L' }, }, }, size: { control: 'number', description: 'The size of the logo in pixels', table: { type: { summary: 'number' }, defaultValue: { summary: '32' }, }, }, }, } satisfies Meta export default meta type Story = StoryObj type AirlineLogoStoryArgs = NonNullable const defaultRender = (args: AirlineLogoStoryArgs) => ({ components: { CpAirlineLogo }, setup() { return { args } }, template: '', }) /** * Default airline logo. Use the controls to experiment with each prop in * isolation. */ export const Default: Story = { args: { iataCode: 'AF', size: 32, }, render: defaultRender, } /** * Logo rendered at the sizes most commonly used across the design system. */ export const Sizes: Story = { parameters: { controls: { disable: true } }, render: () => ({ components: { CpAirlineLogo }, setup() { return { airlineSizes, docCellStyle, docLabelStyle, docRowWrapStyle } }, template: `
{{ size }}px
`, }), } /** * A sample of common airline logos displayed side by side. */ export const MultipleAirlines: Story = { parameters: { controls: { disable: true } }, render: () => ({ components: { CpAirlineLogo }, template: `
`, }), } /** * With an empty `iataCode`, the component falls back to a neutral * placeholder. */ export const EmptyIATACode: Story = { args: { iataCode: '', size: 32, }, render: defaultRender, }