PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / 1.4.1
Starter Sites & Templates by Neve v1.4.1
1.4.1 1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / assets / src / Components / StarterSiteCard.js
templates-patterns-collection / assets / src / Components Last commit date
CloudLibrary 1 year ago Settings 1 year ago StarterSites 3 years ago App.js 2 years ago Card.js 3 years ago CategoriesTabs.js 3 years ago CategorySelector.js 2 years ago CustomTooltip.js 3 years ago DocNotice.js 2 years ago EditorSelector.js 2 years ago EditorTabs.js 4 years ago Header.js 2 years ago Icon.js 2 years ago ImportModal.js 1 year ago ImportModalError.js 2 years ago ImportModalMock.js 4 years ago ImportModalNote.js 4 years ago ImportStepper.js 1 year ago InstallModal.js 1 year ago License.js 2 years ago LicensePanelContext.js 3 years ago Loading.js 4 years ago Main.js 1 year ago Migration.js 4 years ago NewTCNotice.js 1 year ago Notification.js 4 years ago OnboardingContent.js 4 years ago PreviewFrame.js 3 years ago Search.js 2 years ago StarterSiteCard.js 3 years ago
StarterSiteCard.js
143 lines
1 /* eslint-disable camelcase */
2 import { withDispatch } from '@wordpress/data';
3 import { Button, Dashicon } from '@wordpress/components';
4 import { useState } from '@wordpress/element';
5 import { compose } from '@wordpress/compose';
6 import { __ } from '@wordpress/i18n';
7
8 import classnames from 'classnames';
9
10 const StarterSiteCard = ( {
11 data,
12 setSite,
13 setPreview,
14 setModal,
15 setImportingPages,
16 } ) => {
17 const { upsell, screenshot, title, has_templates, isNew } = data;
18 const [ actionsClass, setActionClass ] = useState( '' );
19
20 const showActions = () => {
21 setActionClass( 'visible' );
22 };
23 const hideActions = () => {
24 setActionClass( '' );
25 };
26
27 const launchImport = ( e ) => {
28 e.preventDefault();
29
30 setSite();
31 setModal( true );
32 };
33
34 const launchPreview = ( e ) => {
35 e.preventDefault();
36 setSite();
37 setPreview( true );
38 };
39
40 const cardClassNames = classnames( 'card starter-site-card', {
41 'has-templates': has_templates,
42 } );
43
44 return (
45 <div
46 onMouseEnter={ showActions }
47 onMouseLeave={ hideActions }
48 className={ cardClassNames }
49 >
50 { isNew && (
51 <span className="new-badge">
52 { __(
53 'New',
54 'templates-patterns-collection'
55 ).toUpperCase() }
56 </span>
57 ) }
58 <div className="top">
59 <div className={ 'actions ' + actionsClass }>
60 <Button isSecondary onClick={ launchPreview }>
61 { __( 'Preview', 'templates-patterns-collection' ) }
62 </Button>
63 { ! upsell && (
64 <Button
65 isPrimary
66 className="import"
67 onClick={ launchImport }
68 >
69 { __( 'Import', 'templates-patterns-collection' ) }
70 </Button>
71 ) }
72 { ! has_templates && upsell && (
73 <Button
74 isLink
75 className="templates"
76 target="_blank"
77 href="https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatecloud&utm_content=neve"
78 >
79 { __(
80 'Unlock access with Business plan',
81 'templates-patterns-collection'
82 ) }
83 </Button>
84 ) }
85 { has_templates && (
86 <Button
87 isLink
88 className="templates"
89 onClick={ ( e ) => {
90 e.preventDefault();
91 setSite();
92 setImportingPages();
93 } }
94 >
95 { __(
96 'View Pages',
97 'templates-patterns-collection'
98 ) }
99 </Button>
100 ) }
101 </div>
102 { screenshot && (
103 <div
104 className="image"
105 style={ {
106 backgroundImage: `url("${ screenshot }")`,
107 } }
108 />
109 ) }
110 </div>
111 <div className="bottom">
112 <p className="title">{ title }</p>
113 { upsell && (
114 <span className="pro-badge">
115 <Dashicon icon="lock" size={ 15 } />
116 <span>
117 { __( 'Premium', 'templates-patterns-collection' ) }
118 </span>
119 </span>
120 ) }
121 </div>
122 </div>
123 );
124 };
125
126 export default compose(
127 withDispatch( ( dispatch, { data } ) => {
128 const { slug } = data;
129 const {
130 setCurrentSite,
131 setPreviewStatus,
132 setImportModalStatus,
133 setSingleTemplateImport,
134 } = dispatch( 'neve-onboarding' );
135 return {
136 setSite: () => setCurrentSite( data ),
137 setPreview: ( status ) => setPreviewStatus( status ),
138 setModal: ( status ) => setImportModalStatus( status ),
139 setImportingPages: () => setSingleTemplateImport( slug ),
140 };
141 } )
142 )( StarterSiteCard );
143