diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/PreviewModal.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/PreviewModal.tsx index dbd15d28c8..6f3d07b53e 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/PreviewModal.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/PreviewModal.tsx @@ -20,6 +20,7 @@ export interface PreviewModalProps { buttonsDisabled?: boolean previewToolbar?: boolean; previewToolbarURLs?: SelectOption[]; + selectedURL?: string; sidebarButtons?: React.ReactNode; sidebarHeader?: React.ReactNode; sidebarPadding?: boolean; @@ -39,8 +40,9 @@ export const PreviewModalContent: React.FC = ({ cancelLabel = 'Cancel', okLabel = 'OK', okColor = 'black', - previewToolbarURLs, previewToolbar = true, + previewToolbarURLs, + selectedURL, buttonsDisabled, sidebarButtons, sidebarHeader, @@ -69,7 +71,7 @@ export const PreviewModalContent: React.FC = ({ let toolbarCenter = (<>); if (previewToolbarURLs) { toolbarCenter = ( - {}} /> + {}} /> ); } diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/Select.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/Select.tsx index 9c28b1b89e..c7872058a5 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/Select.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/Select.tsx @@ -9,7 +9,7 @@ export interface SelectOption { label: string; } -interface SelectProps { +export interface SelectProps { title?: string; prompt?: string; options: SelectOption[]; diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/TabView.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/TabView.tsx index 4bbfad792c..edc3220639 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/TabView.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/TabView.tsx @@ -9,10 +9,11 @@ export type Tab = { interface TabViewProps { tabs: Tab[]; + onTabChange?: (id: string) => void; defaultSelected?: string; } -const TabView: React.FC = ({tabs, defaultSelected}) => { +const TabView: React.FC = ({tabs, onTabChange, defaultSelected}) => { if (tabs.length !== 0 && defaultSelected === undefined) { defaultSelected = tabs[0].id; } @@ -26,6 +27,7 @@ const TabView: React.FC = ({tabs, defaultSelected}) => { const handleTabChange = (e: React.MouseEvent) => { const newTab = e.currentTarget.id; setSelectedTab(newTab); + onTabChange?.(newTab); }; return ( diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/URLSelect.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/URLSelect.tsx index f774926554..bf9451e068 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/URLSelect.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/URLSelect.tsx @@ -1,13 +1,8 @@ import React from 'react'; -import Select, {SelectOption} from './Select'; +import Select, {SelectProps} from './Select'; import clsx from 'clsx'; -interface URLSelectProps { - options: SelectOption[]; - onSelect: (value: string) => void; -} - -const URLSelect: React.FC = ({options, onSelect}) => { +const URLSelect: React.FC = (props) => { const selectClasses = clsx( `!h-[unset] w-full appearance-none rounded-full border border-grey-100 bg-white px-3 py-1 text-sm` ); @@ -20,12 +15,11 @@ const URLSelect: React.FC = ({options, onSelect}) => { return (