templates-patterns-collection
/
onboarding
/
src
/
Components
/
CustomizeControls
/
FeaturesControl.js
FeaturesControl.js
1 year ago
ImportOptionsControl.js
1 year ago
LogoControl.js
1 year ago
PaletteControl.js
1 year ago
SiteNameControl.js
1 year ago
TypographyControl.js
2 months ago
FeaturesControl.js
40 lines
| 1 | import { __ } from '@wordpress/i18n'; |
| 2 | import { compose } from '@wordpress/compose'; |
| 3 | import { withSelect, withDispatch } from '@wordpress/data'; |
| 4 | import FeaturesList from '../FeaturesList'; |
| 5 | |
| 6 | const FeaturesControl = ( { importData, togglePluginInstall } ) => { |
| 7 | return ( |
| 8 | <div className="ob-ctrl"> |
| 9 | <div className="ob-ctrl-wrap input"> |
| 10 | <FeaturesList requiredPlugins={importData?.mandatory_plugins ?? {}} onToggle={togglePluginInstall} /> |
| 11 | </div> |
| 12 | </div> |
| 13 | ); |
| 14 | }; |
| 15 | |
| 16 | export default compose( |
| 17 | withSelect( ( select ) => { |
| 18 | const { getImportData, getPluginOptions } = |
| 19 | select( 'ti-onboarding' ); |
| 20 | return { |
| 21 | importData: getImportData(), |
| 22 | pluginOptions: getPluginOptions(), |
| 23 | }; |
| 24 | } ), |
| 25 | withDispatch( |
| 26 | ( dispatch, { pluginOptions } ) => { |
| 27 | const { setPluginOptions } = dispatch( 'ti-onboarding' ); |
| 28 | |
| 29 | return { |
| 30 | togglePluginInstall: (pluginSlug, value) => { |
| 31 | setPluginOptions({ |
| 32 | ...pluginOptions, |
| 33 | [ pluginSlug ]: value |
| 34 | }); |
| 35 | } |
| 36 | }; |
| 37 | } |
| 38 | ) |
| 39 | )( FeaturesControl ); |
| 40 |