zeeth-boilerplate-generator-cli
Version:
Boilerplate generator for the zeeth frontend framework
75 lines (62 loc) • 1.85 kB
JavaScript
const capitalizeFirstLetter = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1)
}
export const basicIndexTemplate = (name, type) => {
const capitalized_name = capitalizeFirstLetter(name)
return `import React from 'react'
import { M } from '@commons/typography'
import { ${type} } from '@commons/Containers'
const ${capitalized_name} = () => {
return (
<${type}>
<M>${capitalized_name}</M>
</${type}>
)
}
export default ${capitalized_name}
`
}
// export const basicStylesTemplate = (name, type) => {
// return `import styled from '@emotion/native'
// import { ${type} } from '@commons/Containers'
// export const ${capitalizeFirstLetter(name)}Styled = styled(${type})\`
// /* styles go here */
// \`
// `
// }
// export const basicTestTemplate = (name) => {
// const capitalized_name = capitalizeFirstLetter(name)
// return `import React from 'react'
// import { render, screen } from '@testing-library/react'
// import '@testing-library/jest-dom/extend-expect'
// import ${capitalized_name} from './'
// describe('${capitalized_name}', () => {
// it('renders and expect nothing', () => {
// render(<${capitalized_name} />)
// expect(true).toBe(true)
// })
// })`
// }
export const basicStoriesTemplate = (name) => {
const capitalized_name = capitalizeFirstLetter(name)
return `import React from 'react'
import {StoryObj, Meta} from '@storybook/react'
import ${capitalized_name} from './'
const meta: Meta<typeof ${capitalized_name}> = {
title: 'basics/${capitalized_name}',
component: ${capitalized_name},
parameters: {
design: {
type: 'figma',
url: '',
},
},
}
export default meta
type Story = StoryObj<typeof Input>
const Template = args => <${capitalized_name} {...args} />
export const Basic: Story = {
args: {},
}
`
}