| 1 |
import { ExternalLink } from '@wordpress/components' |
| 2 |
import { createInterpolateElement } from '@wordpress/element' |
| 3 |
import { __ } from '@wordpress/i18n' |
| 4 |
import React, { useState } from 'react' |
| 5 |
import { isLicensed } from '../../utils/screen' |
| 6 |
import { Button } from './Button' |
| 7 |
|
| 8 |
export const UpsellBanner = () => { |
| 9 |
const [isDismissed, setIsDismissed] = useState(false) |
| 10 |
|
| 11 |
return isDismissed || isLicensed() || window.CODE_SNIPPETS_EDIT?.hideUpsell |
| 12 |
? null |
| 13 |
: <div className="code-snippets-upsell-banner"> |
| 14 |
<img |
| 15 |
src={`${window.CODE_SNIPPETS?.urls.plugin}/assets/icon.svg`} |
| 16 |
alt={__('Code Snippets logo', 'code-snippets')} |
| 17 |
height="34" |
| 18 |
/> |
| 19 |
<p> |
| 20 |
{createInterpolateElement( |
| 21 |
__('Unlock <strong>cloud sync, snippet conditions, AI features</strong> and much more with Code Snippets Pro.', 'code-snippets'), |
| 22 |
{ strong: <strong /> } |
| 23 |
)} |
| 24 |
</p> |
| 25 |
|
| 26 |
<ExternalLink |
| 27 |
className="button button-primary button-large" |
| 28 |
href="https://codesnippets.pro/pricing/" |
| 29 |
> |
| 30 |
{__('Get Started', 'code-snippets')} |
| 31 |
</ExternalLink> |
| 32 |
|
| 33 |
<Button small link onClick={() => setIsDismissed(true)}> |
| 34 |
<span className="dashicons dashicons-no-alt"></span> |
| 35 |
</Button> |
| 36 |
</div> |
| 37 |
} |
| 38 |
|