import React from 'react' import { type Meta } from '@storybook/react-vite' import { replaceDelimiter } from '../../services/HelperServiceTyped' import { DocsTemplate } from '../../../.storybook' export const Example = (args: { /** The string that needs to be passed into this function. */ text: string /** The string to join the split parts with. Defaults to space. */ joinOption?: string /** The string or character to split by. Defaults to underscore. */ splitSymbol?: string /** Option to prevent the use of `capitalize` (used in this function) and keep the casing of the string passed into `text`. */ keepCasing?: boolean }): React.JSX.Element => { const { text, joinOption, splitSymbol, keepCasing } = args return <>{replaceDelimiter({ text, joinOption, splitSymbol, keepCasing })} } Example.storyName = 'replaceDelimiter' Example.args = { text: 'hello_world', joinOption: ' ', splitSymbol: '_', keepCasing: false, } export default { title: 'Helper Functions/replaceDelimiter', component: Example, parameters: { viewMode: 'docs', previewTabs: { canvas: { hidden: true }, }, docs: { page: () => ( <> replaceDelimiter accepts an object with parameters, making it easy to use with named arguments. , All parameters except text are optional with sensible defaults. , By default, replaceDelimiter capitalizes each word part when joining. , ]} /> ), }, }, } as Meta