-
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 #32 from WebDevStudios/release/WDSBT-v1.0
Release/WDSBT v1.0
- Loading branch information
Showing
37 changed files
with
5,754 additions
and
7,272 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ vendor/ | |
# theme | ||
build/ | ||
/blocks/ | ||
!assets/blocks/ | ||
|
||
#tests | ||
pa11y-ci-report/ | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
blocks | ||
./blocks | ||
build | ||
node_modules | ||
vendor | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
v20.12.2 | ||
v22.5.1 |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
blocks/ | ||
/blocks/ | ||
!assets/blocks/ | ||
build/ | ||
node_modules/ | ||
vendor/ | ||
|
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
build/ | ||
/blocks/ | ||
!assets/blocks/ | ||
/build/ | ||
vendor/ | ||
node_modules/ | ||
!.*.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
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,101 @@ | ||
import { addFilter } from '@wordpress/hooks'; | ||
import { createHigherOrderComponent } from '@wordpress/compose'; | ||
import { InspectorControls } from '@wordpress/block-editor'; | ||
import { | ||
PanelBody, | ||
PanelRow, | ||
ButtonGroup, | ||
Button, | ||
} from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Renders the edit component for the button block. | ||
* | ||
* @param {Object} props - The properties passed to the component. | ||
* @param {Object} props.attributes - The attributes of the button block. | ||
* @param {string} props.attributes.buttonSize - The size of the button. | ||
* @param {Function} props.setAttributes - The function to set the attributes of the button block. | ||
* @return {JSX.Element} The rendered edit component. | ||
*/ | ||
function Edit({ attributes: { buttonSize }, setAttributes }) { | ||
const handleChange = (newSize) => { | ||
// Check if we are toggling the size off | ||
const size = buttonSize === newSize ? undefined : newSize; | ||
const buttonClass = buttonSize !== newSize ? 'has-size-' + newSize : ''; | ||
|
||
// Update attributes. | ||
setAttributes({ | ||
buttonSize: size, | ||
className: buttonClass, | ||
}); | ||
}; | ||
|
||
return ( | ||
<InspectorControls> | ||
<PanelBody title={__('Button Sizes')}> | ||
<PanelRow> | ||
<ButtonGroup aria-label={__('Button Sizes')}> | ||
{['s', 'm', 'l', 'xl'].map((sizeValue) => { | ||
return ( | ||
<Button | ||
key={sizeValue} | ||
size="medium" | ||
variant={ | ||
buttonSize === sizeValue | ||
? 'primary' | ||
: undefined | ||
} | ||
onClick={() => handleChange(sizeValue)} | ||
> | ||
{sizeValue.toUpperCase()} | ||
</Button> | ||
); | ||
})} | ||
</ButtonGroup> | ||
</PanelRow> | ||
</PanelBody> | ||
</InspectorControls> | ||
); | ||
} | ||
|
||
addFilter( | ||
'blocks.registerBlockType', | ||
'wds-bt/button-sizes', | ||
(settings, name) => { | ||
if (name !== 'core/button') { | ||
return settings; | ||
} | ||
|
||
return { | ||
...settings, | ||
attributes: { | ||
...settings.attributes, | ||
buttonSize: { | ||
type: 'string', | ||
selector: 'a', | ||
default: '', | ||
}, | ||
}, | ||
}; | ||
} | ||
); | ||
|
||
addFilter( | ||
'editor.BlockEdit', | ||
'wds-bt/button-sizes', | ||
createHigherOrderComponent((BlockEdit) => { | ||
return (props) => { | ||
if (props.name !== 'core/button') { | ||
return <BlockEdit {...props} />; | ||
} | ||
|
||
return ( | ||
<> | ||
<BlockEdit {...props} /> | ||
<Edit {...props} /> | ||
</> | ||
); | ||
}; | ||
}) | ||
); |
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
|
||
// Import the block filter file. | ||
import './unregister-core-embed'; | ||
import './buttons'; |
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
Oops, something went wrong.