1+ import { reactNode , validateProps } from '@msinternal/botframework-webchat-react-valibot' ;
12import { useStyles } from '@msinternal/botframework-webchat-styles/react' ;
23import cx from 'classnames' ;
3- import React , { memo , type ReactNode } from 'react' ;
4+ import React , { memo } from 'react' ;
5+ import { object , optional , pipe , readonly , type InferOutput } from 'valibot' ;
46
57import styles from './StackedLayout.module.css' ;
68
7- type StackedLayoutMainProps = Readonly < {
8- avatar ?: ReactNode | undefined ;
9- children ?: ReactNode | undefined ;
10- } > ;
9+ const stackedLayoutMainPropsSchema = pipe (
10+ object ( {
11+ avatar : optional ( reactNode ( ) ) ,
12+ children : optional ( reactNode ( ) )
13+ } ) ,
14+ readonly ( )
15+ ) ;
1116
12- const StackedLayoutMain = memo ( ( { avatar, children } : StackedLayoutMainProps ) => {
17+ type StackedLayoutMainProps = InferOutput < typeof stackedLayoutMainPropsSchema > ;
18+
19+ const StackedLayoutMain = memo ( ( props : StackedLayoutMainProps ) => {
20+ const { avatar, children } = validateProps ( stackedLayoutMainPropsSchema , props ) ;
1321 const classNames = useStyles ( styles ) ;
1422
1523 return (
@@ -24,3 +32,4 @@ const StackedLayoutMain = memo(({ avatar, children }: StackedLayoutMainProps) =>
2432StackedLayoutMain . displayName = 'StackedLayoutMain' ;
2533
2634export default StackedLayoutMain ;
35+ export { stackedLayoutMainPropsSchema , type StackedLayoutMainProps } ;
0 commit comments