diff --git a/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts b/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts new file mode 100644 index 0000000000..11994de524 --- /dev/null +++ b/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts @@ -0,0 +1,29 @@ +import styled, { css } from 'styled-components' + +import { FlexGroup } from 'uiSrc/components/base/layout/flex' +import { IconButton } from 'uiSrc/components/base/forms/buttons' +import { IconButtonProps } from 'uiSrc/components/base/forms/buttons/IconButton' + +export const CopilotWrapper = styled(FlexGroup)` + user-select: none; +` + +export const CopilotIconButton = styled(IconButton)< + { isOpen: boolean } & IconButtonProps +>` + padding: ${({ theme }) => theme.core.space.space200}; + + // TODO: Remove this once size property is enabled for IconButton + svg { + width: 21px; + height: 21px; + color: var(--triggerIconActiveColor); + } + + ${({ isOpen }) => + isOpen && + css` + background-color: ${({ theme }) => + theme.semantic.color.background.primary200}; + `} +` diff --git a/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.tsx b/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.tsx index 566bee3bd0..fec74accf7 100644 --- a/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.tsx +++ b/redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.tsx @@ -1,6 +1,4 @@ import React from 'react' -import cx from 'classnames' - import { useDispatch, useSelector } from 'react-redux' import { sidePanelsSelector, @@ -10,34 +8,32 @@ import { import { RiTooltip } from 'uiSrc/components' import { CopilotIcon } from 'uiSrc/components/base/icons' import { SidePanels } from 'uiSrc/slices/interfaces/insights' -import { EmptyButton } from 'uiSrc/components/base/forms/buttons' -import styles from './styles.module.scss' +import { CopilotWrapper, CopilotIconButton } from './CopilotTrigger.styles' const CopilotTrigger = () => { const { openedPanel } = useSelector(sidePanelsSelector) - const dispatch = useDispatch() const handleClickTrigger = () => { dispatch(toggleSidePanel(SidePanels.AiAssistant)) } + const isCopilotOpen = openedPanel === SidePanels.AiAssistant + return ( -