11import { validateProps } from '@msinternal/botframework-webchat-react-valibot' ;
2+ import { useStyles } from '@msinternal/botframework-webchat-styles/react' ;
23import { hooks } from 'botframework-webchat-api' ;
3- import classNames from 'classnames' ;
4+ import cx from 'classnames' ;
45import React , { forwardRef , memo , useCallback , useMemo , type ForwardedRef , type KeyboardEventHandler } from 'react' ;
56import { useRefFrom } from 'use-ref-from' ;
67import { boolean , function_ , literal , object , optional , pipe , readonly , string , union , type InferInput } from 'valibot' ;
78
8- import useStyleSet from '../../hooks/useStyleSet' ;
99import testIds from '../../testIds' ;
1010import { Tooltip } from '../../Tooltip' ;
1111import ThumbButtonImage from './ThumbButton.Image' ;
1212
13+ import styles from './ThumbButton.module.css' ;
14+
1315const { useLocalizer } = hooks ;
1416
1517const thumbButtonPropsSchema = pipe (
@@ -36,9 +38,9 @@ function ThumbButton(props: ThumbButtonProps, ref: ForwardedRef<HTMLInputElement
3638 props
3739 ) ;
3840
39- const [ { thumbButton } ] = useStyleSet ( ) ;
4041 const localize = useLocalizer ( ) ;
4142 const onClickRef = useRefFrom ( onClick ) ;
43+ const classNames = useStyles ( styles ) ;
4244
4345 const buttonTitle = useMemo (
4446 ( ) => title ?? localize ( direction === 'down' ? 'VOTE_DISLIKE_ALT' : 'VOTE_LIKE_ALT' ) ,
@@ -54,25 +56,19 @@ function ThumbButton(props: ThumbButtonProps, ref: ForwardedRef<HTMLInputElement
5456
5557 return (
5658 < div
57- className = { classNames (
58- 'webchat__thumb -button',
59+ className = { cx (
60+ classNames [ 'thumb -button'] ,
5961 {
60- 'webchat__thumb -button--large' : size === 'large' ,
61- 'webchat__thumb -button--has-submitted' : submitted
62+ [ classNames [ 'thumb -button--large'] ] : size === 'large' ,
63+ [ classNames [ 'thumb -button--has-submitted'] ] : submitted
6264 } ,
63- className ,
64- thumbButton + ''
65+ className
6566 ) }
6667 >
6768 < input
6869 aria-disabled = { disabled ? 'true' : undefined }
6970 aria-label = { buttonTitle }
70- className = { classNames (
71- 'webchat__thumb-button__input' ,
72- { 'webchat__thumb-button__input--is-pressed' : pressed } ,
73- className ,
74- thumbButton + ''
75- ) }
71+ className = { cx ( classNames [ 'thumb-button__input' ] , className ) }
7672 data-testid = { testIds . feedbackButton }
7773 name = { name }
7874 onKeyDown = { handleKeyDown }
@@ -90,19 +86,15 @@ function ThumbButton(props: ThumbButtonProps, ref: ForwardedRef<HTMLInputElement
9086 } ) }
9187 />
9288 < ThumbButtonImage
93- className = { classNames ( 'webchat__thumb-button__image' , 'webchat__thumb-button__image--is-stroked' , {
94- 'webchat__thumb-button__image--is-down' : direction === 'down'
95- } ) }
89+ className = { cx ( classNames [ 'thumb-button__image' ] , classNames [ 'thumb-button__image--is-stroked' ] ) }
9690 direction = { direction }
9791 />
9892 < ThumbButtonImage
99- className = { classNames ( 'webchat__thumb-button__image' , 'webchat__thumb-button__image--is-filled' , {
100- 'webchat__thumb-button__image--is-down' : direction === 'down'
101- } ) }
93+ className = { cx ( classNames [ 'thumb-button__image' ] , classNames [ 'thumb-button__image--is-filled' ] ) }
10294 direction = { direction }
10395 filled = { true }
10496 />
105- < Tooltip className = "webchat__thumb -button__tooltip" > { buttonTitle } </ Tooltip >
97+ < Tooltip className = { classNames [ 'thumb -button__tooltip' ] } > { buttonTitle } </ Tooltip >
10698 </ div >
10799 ) ;
108100}
0 commit comments