Skip to content

Commit 9286b59

Browse files
authored
Merge pull request #876 from devtron-labs/feat/side-navigation
feat: implement SideNavigation component
2 parents 8962295 + a69d8ed commit 9286b59

File tree

15 files changed

+93
-6
lines changed

15 files changed

+93
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.20.0-pre-4",
3+
"version": "1.20.0-pre-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/Common/Constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const SOFTWARE_RELEASE_MANAGEMENT_ROOT = '/software-release-management'
5757
const COST_VISIBILITY_ROOT = '/cost-visibility'
5858
const SECURITY_CENTER_ROOT = '/security-center'
5959
const AUTOMATION_AND_ENABLEMENT_ROOT = '/automation-and-enablement'
60+
const BACKUP_AND_RESTORE_ROOT = '/backup-and-restore'
6061
const GLOBAL_CONFIG_ROOT = '/global-configuration'
6162
const AI_RECOMMENDATIONS_ROOT = '/ai-recommendations'
6263

@@ -123,6 +124,9 @@ export const URLS = {
123124
// AUTOMATION AND ENABLEMENT
124125
AUTOMATION_AND_ENABLEMENT: AUTOMATION_AND_ENABLEMENT_ROOT,
125126
AUTOMATION_AND_ENABLEMENT_JOB: `${AUTOMATION_AND_ENABLEMENT_ROOT}/job`,
127+
// BACKUP AND RESTORE
128+
BACKUP_AND_RESTORE: BACKUP_AND_RESTORE_ROOT,
129+
BACKUP_AND_RESTORE_OVERVIEW: `${BACKUP_AND_RESTORE_ROOT}/overview`,
126130
// GLOBAL CONFIGURATION
127131
GLOBAL_CONFIG: GLOBAL_CONFIG_ROOT,
128132
GLOBAL_CONFIG_DOCKER: `${GLOBAL_CONFIG_ROOT}/docker`,

src/Shared/Components/Backdrop/Backdrop.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const Backdrop = ({
3232
onBackdropMount,
3333
deactivateFocusOnEscape = true,
3434
initialFocus,
35+
returnFocusOnDeactivate,
3536
}: BackdropProps) => {
3637
// STATES
3738
const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null)
@@ -90,6 +91,7 @@ const Backdrop = ({
9091
onEscape={onEscape}
9192
deactivateFocusOnEscape={deactivateFocusOnEscape}
9293
initialFocus={initialFocus ?? undefined}
94+
returnFocusOnDeactivate={returnFocusOnDeactivate}
9395
>
9496
<motion.div
9597
initial={{ opacity: 0 }}

src/Shared/Components/Backdrop/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import { MouseEvent, ReactNode } from 'react'
1818

1919
import { DTFocusTrapType } from '../DTFocusTrap'
2020

21-
export interface BackdropProps extends Pick<DTFocusTrapType, 'deactivateFocusOnEscape' | 'initialFocus' | 'onEscape'> {
21+
export interface BackdropProps
22+
extends Pick<DTFocusTrapType, 'deactivateFocusOnEscape' | 'initialFocus' | 'onEscape' | 'returnFocusOnDeactivate'> {
2223
/**
2324
* The content to be rendered within the backdrop component.
2425
*/

src/Shared/Components/DTFocusTrap/DTFocusTrap.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const DTFocusTrap = ({
4444
deactivateFocusOnEscape = true,
4545
children,
4646
initialFocus = undefined,
47+
returnFocusOnDeactivate = true,
4748
}: DTFocusTrapType) => {
4849
const [isFocusEnabled, setIsFocusEnabled] = useState(true)
4950

@@ -91,6 +92,7 @@ const DTFocusTrap = ({
9192
}
9293
return false
9394
},
95+
returnFocusOnDeactivate,
9496
}}
9597
>
9698
{children}

src/Shared/Components/DTFocusTrap/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { ReactNode } from 'react'
18+
import { Props as FocusTrapProps } from 'focus-trap-react'
1819

1920
/* Mimicking types from Focus React Library */
2021
type FocusTargetValue = HTMLElement | SVGElement | string
@@ -27,7 +28,7 @@ type FocusTargetValueOrFalse = FocusTargetValue | false
2728
*/
2829
type FocusTargetOrFalse = FocusTargetValueOrFalse | (() => FocusTargetValueOrFalse)
2930

30-
export interface DTFocusTrapType {
31+
export interface DTFocusTrapType extends Pick<FocusTrapProps['focusTrapOptions'], 'returnFocusOnDeactivate'> {
3132
/**
3233
* Callback function that gets triggered when the Escape key is pressed. \
3334
* Should be wrapped in useCallback to prevent unnecessary re-renders.

src/Shared/Components/Icon/Icon.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { ReactComponent as ICCircleLoader } from '@IconsV2/ic-circle-loader.svg'
4747
import { ReactComponent as ICCleanBrush } from '@IconsV2/ic-clean-brush.svg'
4848
import { ReactComponent as ICClipboard } from '@IconsV2/ic-clipboard.svg'
4949
import { ReactComponent as ICClock } from '@IconsV2/ic-clock.svg'
50+
import { ReactComponent as ICClockCounterclockwise } from '@IconsV2/ic-clock-counterclockwise.svg'
5051
import { ReactComponent as ICCloseLarge } from '@IconsV2/ic-close-large.svg'
5152
import { ReactComponent as ICCloseSmall } from '@IconsV2/ic-close-small.svg'
5253
import { ReactComponent as ICCloud } from '@IconsV2/ic-cloud.svg'
@@ -104,6 +105,7 @@ import { ReactComponent as ICFilesChanged } from '@IconsV2/ic-files-changed.svg'
104105
import { ReactComponent as ICFilter } from '@IconsV2/ic-filter.svg'
105106
import { ReactComponent as ICFilterApplied } from '@IconsV2/ic-filter-applied.svg'
106107
import { ReactComponent as ICFlask } from '@IconsV2/ic-flask.svg'
108+
import { ReactComponent as ICFloppyDisk } from '@IconsV2/ic-floppy-disk.svg'
107109
import { ReactComponent as ICFluxcdApp } from '@IconsV2/ic-fluxcd-app.svg'
108110
import { ReactComponent as ICFolder } from '@IconsV2/ic-folder.svg'
109111
import { ReactComponent as ICFolderColor } from '@IconsV2/ic-folder-color.svg'
@@ -300,6 +302,7 @@ export const iconMap = {
300302
'ic-circle-loader': ICCircleLoader,
301303
'ic-clean-brush': ICCleanBrush,
302304
'ic-clipboard': ICClipboard,
305+
'ic-clock-counterclockwise': ICClockCounterclockwise,
303306
'ic-clock': ICClock,
304307
'ic-close-large': ICCloseLarge,
305308
'ic-close-small': ICCloseSmall,
@@ -358,6 +361,7 @@ export const iconMap = {
358361
'ic-filter-applied': ICFilterApplied,
359362
'ic-filter': ICFilter,
360363
'ic-flask': ICFlask,
364+
'ic-floppy-disk': ICFloppyDisk,
361365
'ic-fluxcd-app': ICFluxcdApp,
362366
'ic-folder-color': ICFolderColor,
363367
'ic-folder-user': ICFolderUser,

0 commit comments

Comments
 (0)