| 1 |
import { CloseButton } from '@page-creator/components/topbar/CloseButton'; |
| 2 |
import { extendifyLogo } from '@page-creator/icons/extendify-logo'; |
| 3 |
import { __, sprintf } from '@wordpress/i18n'; |
| 4 |
import { Icon } from '@wordpress/icons'; |
| 5 |
import classNames from 'classnames'; |
| 6 |
|
| 7 |
const { partnerLogo, partnerName } = window.extSharedData; |
| 8 |
|
| 9 |
export const Topbar = ({ openOnNewPage, updateUserOption, onClose }) => { |
| 10 |
return ( |
| 11 |
<header |
| 12 |
className={classNames( |
| 13 |
'flex max-h-28 flex-row items-center justify-between p-5 md:px-8 md:py-5', |
| 14 |
{ |
| 15 |
'bg-banner-main': partnerLogo, |
| 16 |
}, |
| 17 |
)} |
| 18 |
> |
| 19 |
<div> |
| 20 |
{partnerLogo ? ( |
| 21 |
<div className="flex justify-center bg-banner-main"> |
| 22 |
<div className="flex h-6 max-w-40 overflow-hidden md:h-8 md:max-w-64"> |
| 23 |
<img |
| 24 |
className="max-h-full max-w-full object-contain" |
| 25 |
src={partnerLogo} |
| 26 |
alt={partnerName} |
| 27 |
/> |
| 28 |
</div> |
| 29 |
</div> |
| 30 |
) : ( |
| 31 |
<div className="-mb-5 hidden px-5 py-3 text-extendify-black sm:flex sm:pt-5"> |
| 32 |
<Icon icon={extendifyLogo} size={40} /> |
| 33 |
</div> |
| 34 |
)} |
| 35 |
</div> |
| 36 |
<div |
| 37 |
className={classNames( |
| 38 |
'flex w-auto flex-shrink-0 items-center justify-end gap-4', |
| 39 |
{ |
| 40 |
'text-banner-text': partnerLogo, |
| 41 |
}, |
| 42 |
)} |
| 43 |
> |
| 44 |
<label |
| 45 |
className="flex items-center gap-2" |
| 46 |
htmlFor="extendify-open-on-new-pages" |
| 47 |
title={sprintf( |
| 48 |
// translators: %s: Extendify AI Page creator term |
| 49 |
__('Toggle %s on new pages', 'extendify-local'), |
| 50 |
'Extendify AI Page Creator', |
| 51 |
)} |
| 52 |
> |
| 53 |
<input |
| 54 |
id="extendify-open-on-new-pages" |
| 55 |
className="m-0 rounded-xs border border-solid border-gray-900" |
| 56 |
type="checkbox" |
| 57 |
checked={openOnNewPage} |
| 58 |
onChange={(e) => |
| 59 |
updateUserOption('openOnNewPage', e.target.checked) |
| 60 |
} |
| 61 |
/> |
| 62 |
<span>{__('Open for new pages', 'extendify-local')}</span> |
| 63 |
</label> |
| 64 |
<div> |
| 65 |
<CloseButton onClose={onClose} /> |
| 66 |
</div> |
| 67 |
</div> |
| 68 |
</header> |
| 69 |
); |
| 70 |
}; |
| 71 |
|