Skip to content

Commit

Permalink
feat: improve examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed Jun 21, 2024
1 parent 4d94fee commit f780e4e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
17 changes: 16 additions & 1 deletion .clingon/templates/component/Component.stories.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
function stories() {}
import type { Meta, StoryObj } from '@storybook/react'

import { ResourceName } from './ResourceName'

const meta: Meta<typeof ResourceName> = {
component: ResourceName
}

export default meta
type Story = StoryObj<typeof ResourceName>

export const Primary: Story = {
args: {
message: "I'm a component called ResourceName"
}
}
11 changes: 10 additions & 1 deletion .clingon/templates/component/Component.test.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
function tests() {}
import { render, screen } from '@testing-library/react'
import { describe, it, expect } from 'vitest'

describe('ResourceName', () => {
it("should work's properly", async () => {
render(<ResourceName message="Hello Clingon!" />)

expect(await screen.findByText('Hello Clingon!'))
})
})
6 changes: 4 additions & 2 deletions .clingon/templates/component/Component.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import './ResourceName.styles.css'

export function ResourceName() {
const message = 'Hello Clingon!'
export interface ResourceNameProps {
message: string
}

export function ResourceName({ message }: ResourceNameProps) {
return (
<div>
<p>{message}</p>
Expand Down
2 changes: 1 addition & 1 deletion .clingon/templates/docs/ReactHookDoc.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ResourceName

> My hok doc
> My hook doc
- Test generate with MD file
7 changes: 7 additions & 0 deletions .clingon/templates/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@
template: ./functions/AsyncFunction.ts
- path: src/utils
template: ./functions/AsyncFunction.spec.ts

# Markdown

- identifier: hook-doc
resources:
- path: src/docs/hooks
template: ./docs/ReactHookDoc.md

0 comments on commit f780e4e

Please sign in to comment.