-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use StudioContentMenu in SettingsModal
- Loading branch information
Showing
7 changed files
with
85 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
.leftNavWrapper { | ||
overflow-y: auto; | ||
width: 250px; | ||
} | ||
|
||
.contentWrapper { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ader/SubHeader/SettingsModalButton/SettingsModal/hooks/useSettingsModalMenuTabConfigs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import type { SettingsModalTabId } from '../../../../../../types/SettingsModalTabId'; | ||
import { | ||
InformationSquareIcon, | ||
SidebarBothIcon, | ||
ShieldLockIcon, | ||
TimerStartIcon, | ||
} from '@studio/icons'; | ||
import { useTranslation } from 'react-i18next'; | ||
import type { StudioMenuTabType } from '@studio/components'; | ||
Check failure on line 10 in frontend/app-development/layout/PageHeader/SubHeader/SettingsModalButton/SettingsModal/hooks/useSettingsModalMenuTabConfigs.tsx GitHub Actions / Typechecking and linting
|
||
|
||
const aboutTabId: SettingsModalTabId = 'about'; | ||
const setupTabId: SettingsModalTabId = 'setup'; | ||
const policyTabId: SettingsModalTabId = 'policy'; | ||
const accessControlTabId: SettingsModalTabId = 'access_control'; | ||
|
||
export const useSettingsModalMenuTabConfigs = () => { | ||
const { t } = useTranslation(); | ||
|
||
const getMenuTabConfigs = (): StudioMenuTabType<SettingsModalTabId>[] => { | ||
return [ | ||
{ | ||
tabId: aboutTabId, | ||
tabName: t(`settings_modal.left_nav_tab_${aboutTabId}`), | ||
icon: <InformationSquareIcon />, | ||
}, | ||
{ | ||
tabId: setupTabId, | ||
tabName: t(`settings_modal.left_nav_tab_${setupTabId}`), | ||
icon: <SidebarBothIcon />, | ||
}, | ||
{ | ||
tabId: policyTabId, | ||
tabName: t(`settings_modal.left_nav_tab_${policyTabId}`), | ||
icon: <ShieldLockIcon />, | ||
}, | ||
{ | ||
tabId: accessControlTabId, | ||
tabName: t(`settings_modal.left_nav_tab_${accessControlTabId}`), | ||
icon: <TimerStartIcon />, | ||
}, | ||
]; | ||
}; | ||
|
||
return { getMenuTabConfigs }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import type { SettingsModalTab } from './SettingsModalTab'; | ||
import type { SettingsModalTabId } from './SettingsModalTabId'; | ||
|
||
export type SettingsModalHandle = { | ||
openSettings: (tab?: SettingsModalTab) => void; | ||
openSettings: (tab?: SettingsModalTabId) => void; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type SettingsModalTabId = 'about' | 'setup' | 'policy' | 'access_control'; |
15 changes: 15 additions & 0 deletions
15
frontend/libs/studio-components/src/components/StudioContentMenu/types/StudioMenuTabType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { ReactNode } from 'react'; | ||
|
||
export type StudioButtonTabType<TabId extends string> = { | ||
icon: ReactNode; | ||
tabName: string; | ||
tabId: TabId; | ||
}; | ||
|
||
export type StudioLinkTabType<TabId extends string> = StudioButtonTabType<TabId> & { | ||
to: string; | ||
}; | ||
|
||
export type StudioMenuTabType<TabId extends string> = | ||
| StudioButtonTabType<TabId> | ||
| StudioLinkTabType<TabId>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters