From 8052ee5f731a804418b784d3b3d36e2818ca9297 Mon Sep 17 00:00:00 2001 From: bang9 Date: Mon, 25 Nov 2024 19:49:11 +0900 Subject: [PATCH] chore: cleanup --- src/components/ui/WidgetButton.tsx | 2 +- src/components/widget/WidgetToggleButton.tsx | 7 ++++--- src/components/widget/WidgetWindowFullScreen.tsx | 9 +-------- src/const.ts | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/components/ui/WidgetButton.tsx b/src/components/ui/WidgetButton.tsx index 596273703..07ebf17f1 100644 --- a/src/components/ui/WidgetButton.tsx +++ b/src/components/ui/WidgetButton.tsx @@ -131,13 +131,13 @@ export const WidgetButton = ({ }: WidgetButtonProps) => { return ( diff --git a/src/components/widget/WidgetToggleButton.tsx b/src/components/widget/WidgetToggleButton.tsx index 7a6cee07f..7e29c5de9 100644 --- a/src/components/widget/WidgetToggleButton.tsx +++ b/src/components/widget/WidgetToggleButton.tsx @@ -16,21 +16,22 @@ const FloatingWidgetButton = styled(WidgetButton)` } `; -export type ToggleButtonProps = Omit; export default function WidgetToggleButton() { const { botStyle } = useWidgetSetting(); const { dir, renderWidgetToggleButton } = useConstantState(); const { isOpen, setIsOpen } = useWidgetState(); - const toggleButtonProps: ToggleButtonProps = { + const toggleButtonProps: WidgetButtonProps = { + dir, isOpen, onClick: () => setIsOpen(!isOpen), accentColor: botStyle.accentColor, + imageUrl: botStyle.toggleButtonUrl, }; if (typeof renderWidgetToggleButton === 'function') { return renderWidgetToggleButton(toggleButtonProps); } - return ; + return ; } diff --git a/src/components/widget/WidgetWindowFullScreen.tsx b/src/components/widget/WidgetWindowFullScreen.tsx index 0cd1845b6..cbaac9136 100644 --- a/src/components/widget/WidgetWindowFullScreen.tsx +++ b/src/components/widget/WidgetWindowFullScreen.tsx @@ -12,14 +12,7 @@ function WidgetWindowFullScreen(props: ChatAiWidgetProps) {
diff --git a/src/const.ts b/src/const.ts index 5bfcaf0e1..57bce938e 100644 --- a/src/const.ts +++ b/src/const.ts @@ -7,7 +7,7 @@ import React from 'react'; import { StringSet } from '@uikit/ui/Label/stringSet'; -import type { ToggleButtonProps } from './components/widget/WidgetToggleButton'; +import type { WidgetButtonProps } from './components/ui/WidgetButton'; import { BotStyle } from './context/WidgetSettingContext'; import RefreshIcon from './icons/ic-refresh.svg'; import { FunctionCallAdapter, SendbirdChatAICallbacks, WidgetCarouselItem } from './types'; @@ -241,7 +241,7 @@ export interface Constant extends ConstantFeatureFlags, ConstantAIFeatures, Cons * @private * @description Custom widget toggle button renderer. */ - renderWidgetToggleButton?: (props: ToggleButtonProps) => React.ReactElement; + renderWidgetToggleButton?: (props: WidgetButtonProps) => React.ReactElement; /** * @private * @description Service name to be used in the widget.