Skip to content

Commit e75e839

Browse files
committed
Add props schema
1 parent ead28aa commit e75e839

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1+
import { reactNode, validateProps } from '@msinternal/botframework-webchat-react-valibot';
12
import { useStyles } from '@msinternal/botframework-webchat-styles/react';
23
import cx from 'classnames';
3-
import React, { Fragment, memo, type ReactNode } from 'react';
4+
import React, { Fragment, memo } from 'react';
5+
import { boolean, object, optional, pipe, readonly, string, type InferInput } from 'valibot';
46

57
import { useVariantClassName } from '../../styles';
68
import SlidingDots from '../assets/SlidingDots';
79
import styles from './ActivityLoader.module.css';
810

9-
function FluentActivityLoader({
10-
children,
11-
className,
12-
showLoader = true
13-
}: Readonly<{ children?: ReactNode | undefined; className?: string | undefined; showLoader?: boolean }>) {
11+
const fluentActivityLoaderPropsSchema = pipe(
12+
object({
13+
children: optional(reactNode()),
14+
className: optional(string()),
15+
showLoader: optional(boolean(), true)
16+
}),
17+
readonly()
18+
);
19+
20+
type FluentActivityLoaderProps = InferInput<typeof fluentActivityLoaderPropsSchema>;
21+
22+
function FluentActivityLoader(props: FluentActivityLoaderProps) {
23+
const { children, className, showLoader } = validateProps(fluentActivityLoaderPropsSchema, props);
24+
1425
const classNames = useStyles(styles);
1526
const variantClassName = useVariantClassName(classNames);
1627

@@ -23,3 +34,4 @@ function FluentActivityLoader({
2334
}
2435

2536
export default memo(FluentActivityLoader);
37+
export { fluentActivityLoaderPropsSchema, type FluentActivityLoaderProps };

0 commit comments

Comments
 (0)