Conversation
…case is missing will work on it later
| const handleClose = (inputValue: string) => { | ||
| action(inputValue); | ||
| setModalState(false); | ||
| console.log('value from dialog: ', inputValue); |
There was a problem hiding this comment.
removed console.log
| const handleClose = (inputValue?: string) => { | ||
| setModalState(false); | ||
| if (inputValue) { | ||
| console.log('value from dialog: ', inputValue); |
There was a problem hiding this comment.
Since we are using the storybook, would it be better to use action instead of console.log?
There was a problem hiding this comment.
removed console.log
| const handleClose = (inputValue?: string) => { | ||
| setModalState(false); | ||
| if (inputValue) { | ||
| console.log('value from dialog: ', inputValue); |
There was a problem hiding this comment.
removed console.log
| const handleClose = (inputValue: string) => { | ||
| action(inputValue); | ||
| setModalState(false); | ||
| console.log('value from dialog: ', inputValue); |
There was a problem hiding this comment.
removed console.log
| const handleClose = (inputValue: string) => { | ||
| action(inputValue); | ||
| setModalState(false); | ||
| console.log('value from dialog: ', inputValue); |
src/components/Dialog/Dialog.tsx
Outdated
| import { action } from '@storybook/addon-actions'; | ||
| import { DiffColorIcon } from '../Icon/Icon.stories'; |
| Children, | ||
| ReactElement, | ||
| cloneElement, | ||
| ReactNode, |
src/components/Dialog/Dialog.tsx
Outdated
| useEffect(() => { | ||
| // console.log('current onclose: ', onClose); | ||
| }, [onClose]); |
There was a problem hiding this comment.
seems like a useless code, should be removed
src/components/Dialog/Dialog.tsx
Outdated
| useEffect(() => { | ||
| if (props.children) { | ||
| console.log( | ||
| 'children props: ', | ||
| props.children, | ||
| ' and its types: ', | ||
| typeof props.children | ||
| ); | ||
| } | ||
| }, [props.children]); |
There was a problem hiding this comment.
is this part for testing purposes? Try to avoid any console.log statements for production
src/components/Dialog/Dialog.tsx
Outdated
| // style={{ | ||
| // width: widthOutput, | ||
| // }} |
| <button | ||
| className={`${showModal ? 'blur' : ''}`} | ||
| onClick={() => { | ||
| // action('button clicked'); |
| import { render, cleanup, fireEvent } from '@testing-library/react'; | ||
| import Dialog from './index'; | ||
|
|
||
| // react |
There was a problem hiding this comment.
not sure what this line does
There was a problem hiding this comment.
You mean cleanup? I want to prevent memory leak and tests which are not "idempotent" (which can lead to difficult to debug errors in your tests), that's why I call cleanup after each test.
| width: widthOutput, | ||
| }; | ||
|
|
||
| // fullview logic |
There was a problem hiding this comment.
you mean full screen here?
There was a problem hiding this comment.
yes MUI they call it full view as props name
work in progress (WIP): working on unit test.