-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from pixelgrade/dev
2.1.7
- Loading branch information
Showing
10 changed files
with
134 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/block-library/src/blocks/post-comments/inspector-controls.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { ToggleControl } from '@wordpress/components'; | ||
import { Fragment, useState } from "@wordpress/element"; | ||
import { ControlsGroup, ControlsSection, ControlsTab } from "@novablocks/block-editor"; | ||
import { useEffect } from '@wordpress/element'; // Import useEffect | ||
|
||
const PostCommentsInspectorControls = ( props ) => { | ||
|
||
const { | ||
attributes, | ||
setAttributes, | ||
} = props; | ||
|
||
const { | ||
hasUserExperience: hasUserExperienceAttribute = true | ||
} = attributes; | ||
|
||
const [hasUserExperience, setHasUserExperience] = useState(hasUserExperienceAttribute); | ||
|
||
useEffect(() => { | ||
setHasUserExperience(hasUserExperienceAttribute); | ||
}, [hasUserExperienceAttribute]); | ||
|
||
return ( | ||
<Fragment> | ||
<ControlsSection | ||
id={ 'layout' } | ||
order={ 10 } | ||
label={ __( 'Elements Visibility', '__plugin_txtd' ) } | ||
group={ __( 'Block Anatomy', '__plugin_txtd' ) } | ||
key={ 'post_comments' }> | ||
<ControlsTab label={ __( 'Settings', '__plugin_txtd' ) }> | ||
<ControlsGroup> | ||
|
||
<ToggleControl | ||
label="User Background or Experience" | ||
help={ | ||
hasUserExperience | ||
? 'Display user background field.' | ||
: 'Hide the user background field.' | ||
} | ||
checked={ hasUserExperience } | ||
onChange={() => { | ||
setHasUserExperience(!hasUserExperience); | ||
setAttributes({ | ||
...attributes, | ||
hasUserExperience: !hasUserExperience, | ||
}); | ||
}} | ||
/> | ||
|
||
|
||
</ControlsGroup> | ||
</ControlsTab> | ||
</ControlsSection> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
export default PostCommentsInspectorControls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters