Skip to content

Commit 4c0116f

Browse files
feat(boxai-sidebar): Additional UI fixes (#3923)
* feat(boxai-sidebar): Additional UI fixes * feat(boxai-sidebar): Additional UI fixes
1 parent 2392641 commit 4c0116f

File tree

7 files changed

+16
-49
lines changed

7 files changed

+16
-49
lines changed

src/elements/content-sidebar/BoxAISidebar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $agentSelectorSidebarWidth: 211px;
1414
}
1515

1616
.bcs-content-header {
17-
margin: 0 tokens.$space-4;
17+
padding: 0 tokens.$space-4;
1818
}
1919

2020
.bcs-scroll-content {

src/elements/content-sidebar/BoxAISidebar.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,6 @@ const BoxAISidebar = (props: BoxAISidebarProps) => {
109109
questionsWithoutInProgress = questionsWithoutInProgress.slice(0, -1);
110110
}
111111

112-
const handleKeyPress = React.useCallback((event: KeyboardEvent) => {
113-
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
114-
event.preventDefault();
115-
event.stopPropagation();
116-
}
117-
}, []);
118-
119-
React.useEffect(() => {
120-
document.addEventListener('keydown', handleKeyPress, { capture: true });
121-
return () => {
122-
document.removeEventListener('keydown', handleKeyPress, { capture: true });
123-
};
124-
}, [handleKeyPress]);
125-
126112
const localizedQuestions = DOCUMENT_SUGGESTED_QUESTIONS.map(question => ({
127113
id: question.id,
128114
label: formatMessage(messages[question.labelId]),

src/elements/content-sidebar/BoxAISidebarContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useIntl } from 'react-intl';
88
import classNames from 'classnames';
99
import { AgentsProvider, BoxAiAgentSelectorWithApi } from '@box/box-ai-agent-selector';
1010
import { IconButton, Tooltip } from '@box/blueprint-web';
11-
import { ArrowsExpand } from '@box/blueprint-web-assets/icons/Line';
11+
import { ArrowsExpand } from '@box/blueprint-web-assets/icons/Fill';
1212
import {
1313
BoxAiContentAnswers,
1414
ClearConversationButton,

src/elements/content-sidebar/SidebarContent.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ $sidebarScrollContentIncreasedWidth: $sidebarScrollContentWidth + 40px;
1616
align-items: center;
1717
justify-content: space-between;
1818
height: $sidebarHeaderHeight;
19-
margin: 0 $sidebarActivityFeedSpacingHorizontal;
20-
padding: 0;
19+
margin: 0;
20+
padding: 0 $sidebarActivityFeedSpacingHorizontal;
2121
border-bottom: 1px solid $bdl-gray-10;
2222

2323
.bcs-title {

src/elements/content-sidebar/SidebarNav.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { injectIntl } from 'react-intl';
99
import type { IntlShape } from 'react-intl';
1010
import noop from 'lodash/noop';
1111
import { BoxAiLogo } from '@box/blueprint-web-assets/icons/Logo';
12-
import { Size5 } from '@box/blueprint-web-assets/tokens/tokens';
12+
import { Size6 } from '@box/blueprint-web-assets/tokens/tokens';
1313
import AdditionalTabs from './additional-tabs';
1414
import DocGenIcon from '../../icon/fill/DocGenIcon';
1515
import IconChatRound from '../../icons/general/IconChatRound';
@@ -93,7 +93,7 @@ const SidebarNav = ({
9393
: intl.formatMessage(messages.sidebarBoxAITitle)
9494
}
9595
>
96-
<BoxAiLogo height={Size5} width={Size5} />
96+
<BoxAiLogo height={Size6} width={Size6} />
9797
</SidebarNavButton>
9898
)}
9999
{hasActivity && (
@@ -105,7 +105,7 @@ const SidebarNav = ({
105105
sidebarView={SIDEBAR_VIEW_ACTIVITY}
106106
tooltip={intl.formatMessage(messages.sidebarActivityTitle)}
107107
>
108-
<IconChatRound />
108+
<IconChatRound className="bcs-SidebarNav-icon" />
109109
</SidebarNavButton>
110110
)}
111111
{hasDetails && (
@@ -117,7 +117,7 @@ const SidebarNav = ({
117117
sidebarView={SIDEBAR_VIEW_DETAILS}
118118
tooltip={intl.formatMessage(messages.sidebarDetailsTitle)}
119119
>
120-
<IconDocInfo />
120+
<IconDocInfo className="bcs-SidebarNav-icon" />
121121
</SidebarNavButton>
122122
)}
123123
{hasSkills && (
@@ -129,7 +129,7 @@ const SidebarNav = ({
129129
sidebarView={SIDEBAR_VIEW_SKILLS}
130130
tooltip={intl.formatMessage(messages.sidebarSkillsTitle)}
131131
>
132-
<IconMagicWand />
132+
<IconMagicWand className="bcs-SidebarNav-icon" />
133133
</SidebarNavButton>
134134
)}
135135
{hasMetadata && (
@@ -141,7 +141,7 @@ const SidebarNav = ({
141141
sidebarView={SIDEBAR_VIEW_METADATA}
142142
tooltip={intl.formatMessage(messages.sidebarMetadataTitle)}
143143
>
144-
<IconMetadataThick />
144+
<IconMetadataThick className="bcs-SidebarNav-icon" />
145145
</SidebarNavButton>
146146
)}
147147
{hasDocGen && (

src/elements/content-sidebar/SidebarNav.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
}
2222

2323
.bcs-SidebarNav-icon {
24-
@include bdl-SidebarNavIcon;
24+
width: 20px;
25+
height: 20px;
26+
27+
path {
28+
fill: $bdl-gray-65;
29+
}
2530
}
2631

2732
.bcs-SidebarNav-overflow {

src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -247,28 +247,4 @@ describe('elements/content-sidebar/BoxAISidebar', () => {
247247

248248
expect(screen.queryByTestId('content-answers-modal')).not.toBeInTheDocument();
249249
});
250-
251-
describe('BoxAISidebar handleKeyPress', () => {
252-
test('should prevent default behavior and stop propagation for ArrowLeft and ArrowRight keys', async () => {
253-
await renderComponent();
254-
255-
const eventLeft = new KeyboardEvent('keydown', { key: 'ArrowLeft' });
256-
const preventDefaultSpy = jest.spyOn(eventLeft, 'preventDefault');
257-
const stopPropagationSpy = jest.spyOn(eventLeft, 'stopPropagation');
258-
259-
document.dispatchEvent(eventLeft);
260-
261-
expect(preventDefaultSpy).toHaveBeenCalled();
262-
expect(stopPropagationSpy).toHaveBeenCalled();
263-
264-
const eventRight = new KeyboardEvent('keydown', { key: 'ArrowRight' });
265-
const preventDefaultSpyRight = jest.spyOn(eventRight, 'preventDefault');
266-
const stopPropagationSpyRight = jest.spyOn(eventRight, 'stopPropagation');
267-
268-
document.dispatchEvent(eventRight);
269-
270-
expect(preventDefaultSpyRight).toHaveBeenCalled();
271-
expect(stopPropagationSpyRight).toHaveBeenCalled();
272-
});
273-
});
274250
});

0 commit comments

Comments
 (0)