| 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 { shouldShowUpsell } from '../../utils/screen' |
| 6 |
import { Button } from './Button' |
| 7 |
|
| 8 |
export const UpsellBanner = () => { |
| 9 |
const [isDismissed, setIsDismissed] = useState(false) |
| 10 |
|
| 11 |
return isDismissed || !shouldShowUpsell() |
| 12 |
? null |
| 13 |
: <div |
| 14 |
className="code-snippets-upsell-banner" |
| 15 |
aria-label={__('Upgrade to Code Snippets Pro', 'code-snippets')} |
| 16 |
role="region" |
| 17 |
> |
| 18 |
<img |
| 19 |
src={`${window.CODE_SNIPPETS?.urls.plugin}/assets/icon.svg`} |
| 20 |
alt={__('Code Snippets logo', 'code-snippets')} |
| 21 |
height="34" |
| 22 |
aria-hidden="true" |
| 23 |
/> |
| 24 |
<p> |
| 25 |
{createInterpolateElement( |
| 26 |
__('Unlock <strong>cloud sync, snippet conditions, AI features</strong> and much more with Code Snippets Pro.', 'code-snippets'), |
| 27 |
{ strong: <strong /> } |
| 28 |
)} |
| 29 |
</p> |
| 30 |
|
| 31 |
<ExternalLink |
| 32 |
className="button button-primary" |
| 33 |
href="https://codesnippets.pro/pricing/" |
| 34 |
> |
| 35 |
{__('Get Started', 'code-snippets')} |
| 36 |
</ExternalLink> |
| 37 |
|
| 38 |
<Button small link onClick={() => setIsDismissed(true)} aria-label={__('Dismiss upsell banner', 'code-snippets')}> |
| 39 |
<span className="dashicons dashicons-no-alt" aria-hidden="true"></span> |
| 40 |
</Button> |
| 41 |
</div> |
| 42 |
} |
| 43 |
|