diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Action.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Action.js new file mode 100644 index 000000000..3e5075503 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Action.js @@ -0,0 +1,5 @@ +const Action = ( { children } ) => ( +
{ children }
+); + +export default Action; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Content.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Content.js new file mode 100644 index 000000000..3f829a587 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Content.js @@ -0,0 +1,16 @@ +import classNames from 'classnames'; + +const Content = ( { children, className = '', id = '' } ) => { + const elementClasses = classNames( + 'ppcp-r-settings-card__content', + className + ); + + return ( +
+ { children } +
+ ); +}; + +export default Content; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/ContentWrapper.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/ContentWrapper.js new file mode 100644 index 000000000..b35a5f9b1 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/ContentWrapper.js @@ -0,0 +1,5 @@ +const ContentWrapper = ( { children } ) => ( +
{ children }
+); + +export default ContentWrapper; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Description.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Description.js new file mode 100644 index 000000000..1d638015d --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Description.js @@ -0,0 +1,26 @@ +import classNames from 'classnames'; + +const Description = ( { children, asHtml = false, className = '' } ) => { + // Don't output anything if description is empty. + if ( ! children ) { + return null; + } + + const elementClasses = classNames( + 'ppcp-r-settings-block__description', + className + ); + + if ( ! asHtml ) { + return { children }; + } + + return ( + + ); +}; + +export default Description; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Header.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Header.js new file mode 100644 index 000000000..f767b603e --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Header.js @@ -0,0 +1,12 @@ +import classNames from 'classnames'; + +const Header = ( { children, className = '' } ) => { + const elementClasses = classNames( + 'ppcp-r-settings-block__header', + className + ); + + return
{ children }
; +}; + +export default Header; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/SupplementaryLabel.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/SupplementaryLabel.js new file mode 100644 index 000000000..8d513a275 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/SupplementaryLabel.js @@ -0,0 +1,7 @@ +const SupplementaryLabel = ( { children } ) => ( + + { children } + +); + +export default SupplementaryLabel; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Title.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Title.js new file mode 100644 index 000000000..3885d5af4 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/Title.js @@ -0,0 +1,21 @@ +import classNames from 'classnames'; + +const Title = ( { + children, + altStyle = false, + big = false, + className = '', +} ) => { + const elementClasses = classNames( + 'ppcp-r-settings-block__title', + className, + { + 'style-alt': altStyle, + 'style-big': big, + } + ); + + return { children }; +}; + +export default Title; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/TitleWrapper.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/TitleWrapper.js new file mode 100644 index 000000000..d3f55186e --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/TitleWrapper.js @@ -0,0 +1,5 @@ +const TitleWrapper = ( { children } ) => ( + { children } +); + +export default TitleWrapper; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/index.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/index.js new file mode 100644 index 000000000..13c677050 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Elements/index.js @@ -0,0 +1,8 @@ +export { default as Action } from './Action'; +export { default as Content } from './Content'; +export { default as ContentWrapper } from './ContentWrapper'; +export { default as Description } from './Description'; +export { default as Header } from './Header'; +export { default as SupplementaryLabel } from './SupplementaryLabel'; +export { default as Title } from './Title'; +export { default as TitleWrapper } from './TitleWrapper'; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/SettingsBlock.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlock.js similarity index 100% rename from modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/SettingsBlock.js rename to modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlock.js diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/AccordionSettingsBlock.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/AccordionSettingsBlock.js index cf7f2cee4..630afc267 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/AccordionSettingsBlock.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/AccordionSettingsBlock.js @@ -1,12 +1,6 @@ import Accordion from '../AccordionSection'; -import SettingsBlock from './SettingsBlock'; -import { - Header, - Title, - Action, - Description, - TitleWrapper, -} from './SettingsBlockElements'; +import SettingsBlock from '../SettingsBlock'; +import { Header, Title, Action, Description, TitleWrapper } from '../Elements'; const SettingsAccordion = ( { title, description, children, ...props } ) => ( diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ButtonSettingsBlock.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ButtonSettingsBlock.js index eabdde934..42bc832ed 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ButtonSettingsBlock.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ButtonSettingsBlock.js @@ -1,6 +1,7 @@ import { Button } from '@wordpress/components'; -import SettingsBlock from './SettingsBlock'; -import { Action, Description, Header, Title } from './SettingsBlockElements'; + +import SettingsBlock from '../SettingsBlock'; +import { Action, Description, Header, Title } from '../Elements'; const ButtonSettingsBlock = ( { title, description, ...props } ) => ( diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/FeatureSettingsBlock.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/FeatureSettingsBlock.js index 3f747bda7..8144e30c1 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/FeatureSettingsBlock.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/FeatureSettingsBlock.js @@ -1,6 +1,7 @@ import { Button } from '@wordpress/components'; -import SettingsBlock from './SettingsBlock'; -import { Header, Title, Action, Description } from './SettingsBlockElements'; + +import { Header, Title, Action, Description } from '../Elements'; +import SettingsBlock from '../SettingsBlock'; import TitleBadge from '../TitleBadge'; const FeatureSettingsBlock = ( { title, description, ...props } ) => { @@ -24,7 +25,7 @@ const FeatureSettingsBlock = ( { title, description, ...props } ) => {