Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/examples/Example/ExampleComponent.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { render, screen } from '@testing-library/react'
import { describe, expect, test } from 'vitest'

import { ExampleComponent } from './ExampleComponent'

describe.skip('Run', () => {
test('renders the Run view', () => {
render(<ExampleComponent foo={'foo'} />)
expect(screen.getByText(/foo/i)).toBeDefined()
})
})
22 changes: 22 additions & 0 deletions src/examples/Example/ExampleComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FC } from 'react'

import { NestedComponent } from './internal/components'
import { doSomething, getClassName } from './internal/ExampleComponent.helpers'
import { Foo } from './internal/ExampleComponent.types'

interface IProps {
className?: string
foo: Foo
}

const LOCAL_CONSTANT = 'limited to the scope of this file'

export const ExampleComponent: FC<IProps> = ({ className, foo }) => {
doSomething(foo)
return (
<div className={getClassName(className)}>
<NestedComponent />
<p>{LOCAL_CONSTANT}</p>
</div>
)
}
1 change: 1 addition & 0 deletions src/examples/Example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ExampleComponent } from './ExampleComponent'
19 changes: 19 additions & 0 deletions src/examples/Example/internal/ExampleComponent.helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import s from './example-component.module.scss'
import { Foo } from './ExampleComponent.types'

export const REUSED_CONSTANT = 'reused accross ExampleComponent module'

export const getClassName = (className: string | undefined): string => {
const classNames = [s['example'], 'f']

if (className) {
classNames.push(className)
}

return classNames.join(' ')
}

export function doSomething(foo: Foo): void {
foo
REUSED_CONSTANT
}
1 change: 1 addition & 0 deletions src/examples/Example/internal/ExampleComponent.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Foo = string
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const NestedComponent = () => {
return <div>This is a nested component</div>
}
1 change: 1 addition & 0 deletions src/examples/Example/internal/NestedComponent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NestedComponent } from './NestedComponent'
1 change: 1 addition & 0 deletions src/examples/Example/internal/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NestedComponent } from './NestedComponent'
3 changes: 3 additions & 0 deletions src/examples/Example/internal/example-component.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.example {
display: block;
}