import React from 'react' import { type Meta, type StoryObj } from '@storybook/react-vite' import { DocsTemplate } from '../../../.storybook' import OutputForDemo from '../../../.storybook/templates/OutputForDemo' import { hasValue } from '../../services/HelperServiceTyped' const HasValueTemplate = (args: { item: unknown }): React.JSX.Element => { const { item } = args return (
Input Value: {JSON.stringify(item, null, 2)}
) } export default { title: 'Helper Functions/hasValue', component: HasValueTemplate, parameters: { viewMode: 'docs', previewTabs: { canvas: { hidden: true }, }, docs: { page: () => ( <> A function used to check if the argument passed in has a value (not null or undefined). } infoBullets={[ hasValue is used when you need a boolean returned when checking if a variable has a value. , ]} noArgs noDemo /> ), source: { code: false, }, }, }, argTypes: { item: { control: 'object', description: 'The value to check', }, }, } as Meta type Story = StoryObj const Template: Story = { render: (args) => , } export const Number: Story = { ...Template, args: { item: 10, }, } export const String: Story = { ...Template, args: { item: 'Hello World!', }, } export const Undefined: Story = { ...Template, args: { item: undefined, }, } export const Null: Story = { ...Template, args: { item: null, }, } export const ZeroValue: Story = { ...Template, args: { item: 0, }, } export const EmptyString: Story = { ...Template, args: { item: '', }, } export const EmptyArray: Story = { ...Template, args: { item: [], }, } export const EmptyObject: Story = { ...Template, args: { item: {}, }, }