import React from 'react'
import { type Meta } from '@storybook/react-vite'

import { capitalize } from '../../services/HelperServiceTyped'
import { DocsTemplate } from '../../../.storybook'

export const Example = (args: {
  /** The string that needs to be passed into this function. */
  string: string
}): React.JSX.Element => {
  return <>{capitalize(args.string)}</>
}
Example.storyName = 'capitalize'
Example.args = {
  string: 'hello world!',
}

export default {
  title: 'Helper Functions/capitalize',
  component: Example,
  parameters: {
    viewMode: 'docs',
    previewTabs: {
      canvas: { hidden: true },
    },
    docs: {
      page: () => (
        <>
          <DocsTemplate
            code={`import { capitalize } from '@patterninc/react-ui'

capitalize('hello world!')

Output: 'Hello world!'`}
            description='A function used to capitalize the first character of a string.'
            infoBullets={[
              <span key='first-line'>
                <code>capitalize</code> is used when you only need the first
                character of a string capitalized.
              </span>,
            ]}
          />
        </>
      ),
    },
  },
} as Meta<typeof Example>
