react-code-dataset / wp-calypso /apps /wpcom-block-editor /src /wpcom /features /live-preview /live-preview-notice-plugin.tsx
react-code-dataset / wp-calypso /apps /wpcom-block-editor /src /wpcom /features /live-preview /live-preview-notice-plugin.tsx
Download wp-calypso/apps/wpcom-block-editor/src/wpcom/features/live-preview/live-preview-notice-plugin.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 837 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/wpcom-block-editor/src/wpcom/features/live-preview/live-preview-notice-plugin.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/apps/wpcom-block-editor/src/wpcom/features/live-preview/live-preview-notice-plugin.tsx
-
curl -L -o live-preview-notice-plugin.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/wpcom-block-editor/src/wpcom/features/live-preview/live-preview-notice-plugin.tsx
837 Bytes
| import { useSelect } from '@wordpress/data'; | |
| import { useCanPreviewButNeedUpgrade } from './hooks/use-can-preview-but-need-upgrade'; | |
| import { usePreviewingTheme } from './hooks/use-previewing-theme'; | |
| import { LivePreviewUpgradeButton } from './upgrade-button'; | |
| const LivePreviewNoticePlugin = () => { | |
| const isReady = useSelect( ( select ) => select( 'core/editor' ).__unstableIsEditorReady() ); | |
| const previewingTheme = usePreviewingTheme(); | |
| const { canPreviewButNeedUpgrade, upgradePlan } = useCanPreviewButNeedUpgrade( previewingTheme ); | |
| // Do nothing if the user is NOT previewing a theme. | |
| if ( ! previewingTheme.name ) { | |
| return null; | |
| } | |
| if ( canPreviewButNeedUpgrade && isReady ) { | |
| return <LivePreviewUpgradeButton { ...{ previewingTheme, upgradePlan } } />; | |
| } | |
| return null; | |
| }; | |
| export default LivePreviewNoticePlugin; | |