Skip to content

Commit bc83195

Browse files
jeff-matthewscod62627
authored andcommitted
CCSAAS-2087: Added PaaS badge for staging content
1 parent cb37fca commit bc83195

File tree

5 files changed

+112
-9
lines changed

5 files changed

+112
-9
lines changed

gatsby-browser.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2020 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import React from 'react';
14+
import { MDXProvider } from '@mdx-js/react';
15+
import { Edition } from './src/@adobe/gatsby-theme-aio/components/Edition';
16+
17+
// Define the components that will be available in MDX files
18+
const components = {
19+
// Register the Edition component for inline use
20+
Edition
21+
};
22+
23+
// Wrap the root element with the MDXProvider
24+
export const wrapRootElement = ({ element }) => {
25+
return <MDXProvider components={components}>{element}</MDXProvider>;
26+
};

gatsby-ssr.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 Adobe. All rights reserved.
2+
* Copyright 2020 Adobe. All rights reserved.
33
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License. You may obtain a copy
55
* of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -11,10 +11,16 @@
1111
*/
1212

1313
import React from 'react';
14-
import {withPrefix} from 'gatsby';
14+
import { MDXProvider } from '@mdx-js/react';
15+
import { Edition } from './src/@adobe/gatsby-theme-aio/components/Edition';
1516

16-
export const onRenderBody = ({setHeadComponents}) => {
17-
setHeadComponents([
18-
<script src={withPrefix('/redirections.js')}></script>
19-
]);
20-
};
17+
// Define the components that will be available in MDX files
18+
const components = {
19+
// Register the Edition component for inline use
20+
Edition
21+
};
22+
23+
// Wrap the root element with the MDXProvider
24+
export const wrapRootElement = ({ element }) => {
25+
return <MDXProvider components={components}>{element}</MDXProvider>;
26+
};
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright 2021 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import React from 'react';
14+
import PropTypes from 'prop-types';
15+
import '@spectrum-css/badge';
16+
import '@spectrum-css/link';
17+
import '@spectrum-css/tooltip';
18+
19+
let editionText = '';
20+
let editionColor = '';
21+
let editionTooltip = '';
22+
const EDITIONS_LINK = 'https://experienceleague.adobe.com/en/docs/commerce/user-guides/product-solutions';
23+
24+
const Edition = ({ ...props }) => {
25+
switch (props.name) {
26+
case 'paas':
27+
editionText = 'PaaS only';
28+
editionColor = 'spectrum-Badge--informative';
29+
editionTooltip = 'Applies to Adobe Commerce on Cloud (Adobe-managed PaaS infrastructure) and on-premises projects only.';
30+
break;
31+
case 'saas':
32+
editionText = 'SaaS only';
33+
editionColor = 'spectrum-Badge--positive';
34+
editionTooltip = 'Applies to Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer projects only (Adobe-managed SaaS infrastructure).';
35+
break;
36+
default:
37+
editionText = 'Create an Edition tag';
38+
editionColor = 'spectrum-Badge--yellow';
39+
editionTooltip = '';
40+
}
41+
42+
return (
43+
<a
44+
href={EDITIONS_LINK}
45+
className="spectrum-Link"
46+
target="_blank"
47+
rel="noreferrer"
48+
style={{
49+
textDecoration: 'none',
50+
display: 'inline-block',
51+
marginTop: '1rem',
52+
marginRight: '0.5rem',
53+
position: 'relative'
54+
}}
55+
title={editionTooltip}
56+
>
57+
<span
58+
className={`spectrum-Badge spectrum-Badge--sizeS ${editionColor}`}
59+
style={{ paddingBottom: '4px', cursor: 'pointer' }}
60+
>
61+
{editionText}
62+
</span>
63+
</a>
64+
);
65+
};
66+
67+
Edition.propTypes = {
68+
name: PropTypes.string
69+
};
70+
71+
export { Edition };

src/pages/development/components/app-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: GraphQL Application Server | Commerce PHP Extensions
33
description: Learn about GraphQL Application Server architecture and how to ensure compatibility with custom extensions.
44
keywords:
55
- Extensions
6-
edition: ee
6+
edition: pass
77
---
88

99
<InlineAlert variant="info" slots="text" />

src/pages/development/staging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Staging | Commerce PHP Extensions
33
description: Learn how to manage campaigns in Adobe Commerce and Magento Open Source using the staging module.
4-
edition: ee
4+
edition: paas
55
keywords:
66
- Extensions
77
---

0 commit comments

Comments
 (0)