Skip to content

Commit 6553188

Browse files
authored
RI-7053: replace EuiFlyout with Drawer (#4582)
* RI-7053: use Drawer for ShortcutsFlyout * RI-7053: remove EuiFlyout styles * RI-7053: remove EuiFlyoutHeader reference
1 parent 7de2983 commit 6553188

File tree

9 files changed

+27
-342
lines changed

9 files changed

+27
-342
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Drawer } from '@redis-ui/components'
2+
3+
const DrawerHeader = Drawer.Header
4+
const DrawerBody = Drawer.Body
5+
const DrawerFooter = Drawer.Footer
6+
7+
export { Drawer, DrawerHeader, DrawerBody, DrawerFooter }

redisinsight/ui/src/components/shortcuts-flyout/ShortcutsFlyout.spec.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ beforeEach(() => {
1111
store.clearActions()
1212
})
1313

14+
jest.mock('uiSrc/components/base/layout/drawer', () => ({
15+
...jest.requireActual('uiSrc/components/base/layout/drawer'),
16+
DrawerHeader: jest.fn().mockReturnValue(null),
17+
}))
18+
1419
const appInfoSlicesPath = 'uiSrc/slices/app/info'
1520

1621
jest.mock(appInfoSlicesPath, () => ({

redisinsight/ui/src/components/shortcuts-flyout/ShortcutsFlyout.tsx

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import React from 'react'
22
import cx from 'classnames'
33
import { useDispatch, useSelector } from 'react-redux'
4-
import {
5-
EuiBasicTableColumn,
6-
EuiFlyout,
7-
EuiFlyoutBody,
8-
EuiInMemoryTable,
9-
EuiTitle,
10-
} from '@elastic/eui'
4+
import { EuiBasicTableColumn, EuiInMemoryTable, EuiTitle } from '@elastic/eui'
115
import { appInfoSelector, setShortcutsFlyoutState } from 'uiSrc/slices/app/info'
126
import { KeyboardShortcut } from 'uiSrc/components'
137
import { BuildType } from 'uiSrc/constants/env'
148
import { Spacer } from 'uiSrc/components/base/layout/spacer'
9+
import { Drawer, DrawerHeader, DrawerBody } from 'uiSrc/components/base/layout/drawer'
1510
import { SHORTCUTS, ShortcutGroup, separator } from './schema'
1611

1712
import styles from './styles.module.scss'
@@ -53,29 +48,22 @@ const ShortcutsFlyout = () => {
5348
</div>
5449
)
5550

56-
return isShortcutsFlyoutOpen ? (
57-
<EuiFlyout
58-
ownFocus
59-
size="538px"
60-
onClose={() => dispatch(setShortcutsFlyoutState(false))}
51+
return (
52+
<Drawer
53+
open={isShortcutsFlyoutOpen}
54+
onOpenChange={(isOpen) => dispatch(setShortcutsFlyoutState(isOpen))}
6155
data-test-subj="shortcuts-flyout"
56+
title="Shortcuts"
6257
>
63-
<EuiFlyoutBody>
64-
<EuiTitle
65-
size="s"
66-
className={styles.title}
67-
data-testid="shortcuts-title"
68-
>
69-
<h4>Shortcuts</h4>
70-
</EuiTitle>
71-
<Spacer size="m" />
58+
<DrawerHeader title="Shortcuts" />
59+
<DrawerBody>
7260
{SHORTCUTS.filter(
7361
({ excludeFor }) =>
7462
!excludeFor || !excludeFor.includes(server?.buildType as BuildType),
7563
).map(ShortcutsTable)}
76-
</EuiFlyoutBody>
77-
</EuiFlyout>
78-
) : null
64+
</DrawerBody>
65+
</Drawer>
66+
)
7967
}
8068

8169
export default ShortcutsFlyout

redisinsight/ui/src/components/shortcuts-flyout/styles.module.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
.title {
2-
font-size: 18px;
3-
font-weight: 600 !important;
4-
}
5-
61
.table {
72
:global(thead) {
83
display: none;

redisinsight/ui/src/components/side-panels/panels/enablement-area/EnablementArea/components/InternalPage/InternalPage.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import React, { useMemo, useRef, useEffect, useState } from 'react'
2-
import {
3-
EuiFlyoutHeader,
4-
EuiText,
5-
EuiPopover,
6-
} from '@elastic/eui'
2+
import { EuiText, EuiPopover } from '@elastic/eui'
73
import JsxParser from 'react-jsx-parser'
84
import cx from 'classnames'
95
import { debounce } from 'lodash'
@@ -168,7 +164,7 @@ const InternalPage = (props: Props) => {
168164

169165
return (
170166
<div className={styles.container} data-test-subj="internal-page">
171-
<EuiFlyoutHeader className={styles.header}>
167+
<div className={styles.header}>
172168
<div style={{ padding: 0 }}>
173169
<EuiPopover
174170
initialFocus={false}
@@ -214,7 +210,7 @@ const InternalPage = (props: Props) => {
214210
{title?.toUpperCase()}
215211
</EuiText>
216212
</div>
217-
</EuiFlyoutHeader>
213+
</div>
218214
<div
219215
ref={containerRef}
220216
className={cx(styles.content, 'jsx-markdown')}

redisinsight/ui/src/components/side-panels/panels/enablement-area/styles.module.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@
66
border-radius: 4px 0 0 4px;
77
box-shadow: -5px 0px 16px rgba(0, 0, 0, 0.16) !important;
88
min-width: 476px !important;
9-
10-
:global(.euiFlyout__closeButton) {
11-
background-color: transparent;
12-
height: 10px;
13-
width: 10px;
14-
right: 20px;
15-
top: 20px;
16-
}
17-
18-
:global(.euiFlyoutBody__overflowContent) {
19-
height: 100%;
20-
}
219
}
2210

2311
:global {

redisinsight/ui/src/styles/components/_components.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
@import "database";
1414
@import "switch";
1515
@import "callout";
16-
@import "flyout";
1716
@import "tabs";
1817
@import "notificationBody";
1918
@import "json_view";

redisinsight/ui/src/styles/components/_flyout.scss

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)