Skip to content

Commit

Permalink
Admin Page: Feature Settings Add better docs for feature settings-rel…
Browse files Browse the repository at this point in the history
…ated components (#4417)

* Admin Page: Add docs for the module-settings/connect-module-options High Order Component

* Admin Page: Add docs for the module-settings/module-settings-form High Order Component
  • Loading branch information
oskosk authored and samhotchkiss committed Nov 9, 2016
1 parent df5c441 commit e0191de
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
37 changes: 37 additions & 0 deletions _inc/client/components/module-settings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## connectModuleOptions

A High Order Component that connects to Jetpack modules'options
redux state selectors and action creators.

**Arguments**

* {React.Component} Component - The component to be connected to the state
* Return: {React.Component} - The component with some props connected to the state

This HOC provides the wrapped component with the following property methods

* validValues( option_name )
* getOptionCurrentValue( module_name, option_name)
* getSiteRoles()
* isUpdating ( option_name )
* adminEmailAddress()
* currentIp()
* siteAdminUrl()
* isCurrentUserLinked()
* updateOptions( newOptions )
* regeneratePostByEmailAddress()
* setUnsavedOptionFlag()
* clearUnsavedOptionFlag()

## module-settings-form

A High Order Component that provide a <form> with functionality to handle input values on the forms own React component state.

_Basically useful for using in composition with the connectModuleOptions HOC._

** Props **

* getOptionCurrentValue()
* props.module
* props.updateOptions

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import React from 'react';
*/
import { connectModuleOptions } from 'components/module-settings/connect-module-options';

/**
* High order component that provides a <form> with functionality
* to handle input values on the forms' own React component state.
*
* @param {React.Component} Component The component with a top level form element
* @return {[React.Component]} The component with new functionality
*/
export function ModuleSettingsForm( InnerComponent ) {
const SettingsForm = React.createClass( {
getInitialState() {
Expand Down

0 comments on commit e0191de

Please sign in to comment.