PluginProbe
Extendify / 1.9.3
Extendify v1.9.3
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Library / components / MainButtons.js

MainButtons.js in Extendify 1.9.3, at src/Library/components/MainButtons.js

57 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Button } from '@wordpress/components'
2 import { useEffect } from '@wordpress/element'
3 import { __, sprintf } from '@wordpress/i18n'
4 import { Icon } from '@wordpress/icons'
5 import { useUserStore, useUserStoreReady } from '@library/state/User'
6 import { openModal } from '@library/util/general'
7 import { brandMark } from './icons'
8
9 export const MainButtonWrapper = () => {
10 const hasPendingNewImports = useUserStore(
11 (state) => state.runningImports === -1,
12 )
13 const userDataReady = useUserStoreReady()
14
15 useEffect(() => {
16 if (userDataReady && hasPendingNewImports) {
17 useUserStore.setState({ runningImports: 0 })
18 }
19 }, [hasPendingNewImports, userDataReady])
20
21 return <MainButton text={__('Design Library', 'extendify')} />
22 }
23
24 const MainButton = ({ buttonRef, text }) => (
25 <div className="extendify">
26 <Button
27 variant="primary"
28 ref={buttonRef}
29 className="h-8 xs:h-9 px-1 min-w-0 xs:pl-2 xs:pr-3 sm:ml-2"
30 onClick={() => openModal('main-button')}
31 id="extendify-templates-inserter-btn"
32 icon={
33 <Icon icon={brandMark} size={24} style={{ marginRight: 0 }} />
34 }>
35 <span className="hidden xs:inline ml-1">{text}</span>
36 </Button>
37 </div>
38 )
39
40 export const CtaButton = () => (
41 <Button
42 id="extendify-cta-button"
43 style={{
44 margin: '1rem 1rem 0',
45 width: 'calc(100% - 2rem)',
46 justifyContent: ' center',
47 }}
48 onClick={() => openModal('patterns-cta')}
49 isSecondary>
50 {sprintf(
51 // translators: %s: Extendify Library term.
52 __('Discover patterns in the %s', 'extendify'),
53 'Extendify Library',
54 )}
55 </Button>
56 )
57