-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathindex.tsx
More file actions
52 lines (47 loc) · 1.32 KB
/
index.tsx
File metadata and controls
52 lines (47 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React, { useState } from 'react';
import { useIntl } from 'react-intl';
import {
SubNavLink,
Tooltip,
} from '@strapi/design-system';
import { Lock } from '@strapi/icons';
import { LockedAddonMenuItemProps } from '../../types/pro-addons';
import TrialModal from '../TrialModal';
const LockedAddonMenuItem: React.FC<LockedAddonMenuItemProps> = ({ addon }) => {
const { formatMessage } = useIntl();
const [isModalOpen, setIsModalOpen] = useState(false);
const handleClick = (e: React.MouseEvent) => {
e.preventDefault();
setIsModalOpen(true);
};
return (
<>
<Tooltip
description={formatMessage({
id: 'webtools.sidebar.locked_addon.tooltip',
defaultMessage: 'Start free trial to unlock',
})}
>
<SubNavLink
onClick={handleClick}
style={{
cursor: 'pointer',
opacity: 0.5,
pointerEvents: 'auto',
}}
>
<span style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<Lock width="12px" height="12px" />
{addon.name}
</span>
</SubNavLink>
</Tooltip>
<TrialModal
addon={addon}
isOpen={isModalOpen}
onClose={() => setIsModalOpen(false)}
/>
</>
);
};
export default LockedAddonMenuItem;