diff --git a/client/my-sites/domains/domain-management/subpage-wrapper/headers/add-dns-record-header.tsx b/client/my-sites/domains/domain-management/subpage-wrapper/headers/add-dns-record-header.tsx
deleted file mode 100644
index dd9be27267481..0000000000000
--- a/client/my-sites/domains/domain-management/subpage-wrapper/headers/add-dns-record-header.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { localizeUrl } from '@automattic/i18n-utils';
-import { translate } from 'i18n-calypso';
-import ExternalLink from 'calypso/components/external-link';
-import NavigationHeader from 'calypso/components/navigation-header';
-import { CustomHeaderComponentType } from './custom-header-component-type';
-
-export const addDnsRecordTitle = translate( 'Add a new DNS record' );
-export const addDnsRecordsSubtitle = translate(
- 'DNS records change how your domain works. {{a}}Learn more{{/a}}.',
- {
- components: {
- a: (
-
- ),
- },
- }
-);
-
-const AddDnsRecordHeader: CustomHeaderComponentType = ( {
- selectedDomainName,
- selectedSiteSlug,
-} ) => (
-
- ),
- },
- } ) }
- />
-);
-
-export default AddDnsRecordHeader;
diff --git a/client/my-sites/domains/domain-management/subpage-wrapper/headers/custom-header-component-type.ts b/client/my-sites/domains/domain-management/subpage-wrapper/headers/custom-header-component-type.ts
index b62f79c1d061d..04cc236f8bb63 100644
--- a/client/my-sites/domains/domain-management/subpage-wrapper/headers/custom-header-component-type.ts
+++ b/client/my-sites/domains/domain-management/subpage-wrapper/headers/custom-header-component-type.ts
@@ -1,4 +1,5 @@
export type CustomHeaderComponentType = React.ComponentType< {
selectedDomainName: string;
selectedSiteSlug: string;
+ context?: string;
} >;
diff --git a/client/my-sites/domains/domain-management/subpage-wrapper/headers/dns-record-header.tsx b/client/my-sites/domains/domain-management/subpage-wrapper/headers/dns-record-header.tsx
new file mode 100644
index 0000000000000..c4d2e99180f07
--- /dev/null
+++ b/client/my-sites/domains/domain-management/subpage-wrapper/headers/dns-record-header.tsx
@@ -0,0 +1,59 @@
+import { localizeUrl } from '@automattic/i18n-utils';
+import { translate } from 'i18n-calypso';
+import React from 'react';
+import ExternalLink from 'calypso/components/external-link';
+import NavigationHeader from 'calypso/components/navigation-header';
+import { CustomHeaderComponentType } from './custom-header-component-type';
+
+export const addDnsRecordTitle = translate( 'Add a new DNS record' );
+export const editDnsRecordTitle = translate( 'Edit DNS record' );
+export const addDnsRecordsSubtitle = translate(
+ 'DNS records change how your domain works. {{a}}Learn more{{/a}}.',
+ {
+ components: {
+ a: (
+
+ ),
+ },
+ }
+);
+
+const DnsRecordHeader: CustomHeaderComponentType = ( {
+ selectedDomainName,
+ selectedSiteSlug,
+ context = 'add',
+} ) => {
+ return (
+
+ ),
+ },
+ } ) }
+ />
+ );
+};
+
+export default DnsRecordHeader;
diff --git a/client/my-sites/domains/domain-management/subpage-wrapper/headers/edit-dns-record-header.tsx b/client/my-sites/domains/domain-management/subpage-wrapper/headers/edit-dns-record-header.tsx
deleted file mode 100644
index 8ee2705d144ca..0000000000000
--- a/client/my-sites/domains/domain-management/subpage-wrapper/headers/edit-dns-record-header.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { localizeUrl } from '@automattic/i18n-utils';
-import { translate } from 'i18n-calypso';
-import ExternalLink from 'calypso/components/external-link';
-import NavigationHeader from 'calypso/components/navigation-header';
-import { CustomHeaderComponentType } from './custom-header-component-type';
-
-export const editDnsRecordTitle = translate( 'Edit DNS record' );
-export const editDnsRecordsSubtitle = translate(
- 'DNS records change how your domain works. {{a}}Learn more{{/a}}.',
- {
- components: {
- a: (
-
- ),
- },
- }
-);
-
-const EditDnsRecordHeader: CustomHeaderComponentType = ( {
- selectedDomainName,
- selectedSiteSlug,
-} ) => (
-
- ),
- },
- } ) }
- />
-);
-
-export default EditDnsRecordHeader;
diff --git a/client/my-sites/domains/domain-management/subpage-wrapper/index.tsx b/client/my-sites/domains/domain-management/subpage-wrapper/index.tsx
index 7a0951278166f..3ccc7caa40f4f 100644
--- a/client/my-sites/domains/domain-management/subpage-wrapper/index.tsx
+++ b/client/my-sites/domains/domain-management/subpage-wrapper/index.tsx
@@ -11,12 +11,16 @@ type SubpageWrapperProps = {
};
const SubpageWrapper = ( { children, subpageKey, siteName, domainName }: SubpageWrapperProps ) => {
- const { CustomHeader, title, subtitle } = getSubpageParams( subpageKey ) || {};
+ const { CustomHeader, title, subtitle, context } = getSubpageParams( subpageKey ) || {};
if ( CustomHeader ) {
return (
);
diff --git a/client/my-sites/domains/domain-management/subpage-wrapper/subpages.tsx b/client/my-sites/domains/domain-management/subpage-wrapper/subpages.tsx
index fecd1e24e2295..67b7bb1cab001 100644
--- a/client/my-sites/domains/domain-management/subpage-wrapper/subpages.tsx
+++ b/client/my-sites/domains/domain-management/subpage-wrapper/subpages.tsx
@@ -1,23 +1,21 @@
import { __ } from '@wordpress/i18n';
-import AddDnsRecordHeader, {
- addDnsRecordTitle,
- addDnsRecordsSubtitle,
-} from './headers/add-dns-record-header';
import AddForwardingEmailHeader from './headers/add-fowarding-email-header';
import { CustomHeaderComponentType } from './headers/custom-header-component-type';
+import DnsRecordHeader, {
+ addDnsRecordTitle,
+ addDnsRecordsSubtitle,
+ editDnsRecordTitle,
+} from './headers/dns-record-header';
import DNSRecordsHeader, {
dnsRecordsTitle,
dnsRecordsSubtitle,
} from './headers/dns-records-header';
-import EditDnsRecordHeader, {
- editDnsRecordTitle,
- editDnsRecordsSubtitle,
-} from './headers/edit-dns-record-header';
type SubpageWrapperParamsType = {
CustomHeader?: CustomHeaderComponentType;
title?: string | React.ReactNode;
subtitle?: string | React.ReactNode;
+ context?: string;
[ key: string ]: unknown;
};
@@ -48,18 +46,20 @@ const SUBPAGE_TO_PARAMS_MAP: Record< string, SubpageWrapperParamsType > = {
subtitle: __( "Manage your domain's contact details." ),
},
[ ADD_DNS_RECORD ]: {
- CustomHeader: AddDnsRecordHeader,
+ CustomHeader: DnsRecordHeader,
subPageKey: ADD_DNS_RECORD,
titleOverride: addDnsRecordTitle,
subtitleOverride: addDnsRecordsSubtitle,
showBreadcrumb: false,
+ context: 'add',
},
[ EDIT_DNS_RECORD ]: {
- CustomHeader: EditDnsRecordHeader,
+ CustomHeader: DnsRecordHeader,
subPageKey: EDIT_DNS_RECORD,
titleOverride: editDnsRecordTitle,
- subtitleOverride: editDnsRecordsSubtitle,
+ subtitleOverride: addDnsRecordsSubtitle,
showBreadcrumb: false,
+ context: 'edit',
},
};