Skip to content

Commit

Permalink
Merge pull request #1719 from natura-cosmeticos/DSY-999-debug
Browse files Browse the repository at this point in the history
Dsy 999 debug
  • Loading branch information
Design-System-Natura authored Aug 10, 2022
2 parents db61ba0 + 9a6950b commit 29f44b7
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react/src/components/Debug/Debug.props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface DebugProps {
/**
* Specify an optional className to be added to your Debug
*/
className?: string

/**
* Optional ID for testing
*/
testID?: string;
}
31 changes: 31 additions & 0 deletions packages/react/src/components/Debug/Debug.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { Story, Meta } from '@storybook/react'
import { Debug, DebugProps } from '.'

const componentStatus = `
- - -
**NOTE FOR UXs**: This component is available in the following variants:
- ❌ Standard
With the following attribute statuses:
- **Attributes:**
- ❌ \`Types\`
- - -
`

export default {
title: 'Components/Debug',
component: Debug,
parameters: {
componentSubtitle: '',
docs: { description: { component: componentStatus } }
}
} as Meta

export const Playground: Story<DebugProps> = (args) => (
<Debug {...args} />
)
10 changes: 10 additions & 0 deletions packages/react/src/components/Debug/Debug.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createUseStyles } from 'react-jss'
import { Theme } from '@naturacosmeticos/natds-themes'

const styles = createUseStyles((theme: Theme) => ({
example: {
display: 'flex'
}
}))

export default styles
11 changes: 11 additions & 0 deletions packages/react/src/components/Debug/Debug.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'
import Debug from '.'
import renderWithTheme from '../../helpers/renderWithTheme'

describe('Debug component', () => {
it('should render correctly with default props', () => {
const { styles, component } = renderWithTheme(<Debug />)

expect([styles.toString(), component.container]).toMatchSnapshot()
})
})
25 changes: 25 additions & 0 deletions packages/react/src/components/Debug/Debug.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import styles from './Debug.styles'
import { DebugProps } from './Debug.props'

const Debug = React.forwardRef<HTMLElement, DebugProps>(
(props, ref) => {
const {
className = '',
...rest
} = props
const { example } = styles()

return (
<span
className={`${className} ${example}`}
ref={ref}
{...rest}
>
Debug
</span>
)
}
)

export default Debug
5 changes: 5 additions & 0 deletions packages/react/src/components/Debug/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Debug from './Debug'

export { Debug }
export { DebugProps } from './Debug.props'
export default Debug
1 change: 1 addition & 0 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export * from './components/Switch'
export * from './components/Tag'
export * from './components/Typography'
export * from './components/Chip'
export * from './components/Debug'

0 comments on commit 29f44b7

Please sign in to comment.