|
| 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 }; |
0 commit comments