Skip to content

Commit

Permalink
✨ updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ZafarKamal123 committed Dec 29, 2022
1 parent b42ca5b commit 5a9635a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/blocks-library/src/input-base/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"textarea"
]
},
"styles": {
"style": {
"type": "object",
"default": {
"spacing": {
Expand Down
19 changes: 18 additions & 1 deletion packages/blocks-library/src/selection-base/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,25 @@
"autogeneratedName": {
"type": "string",
"default": ""
},
"style": {
"type": "object",
"default": {
"spacing": {
"margin": {
"top": "0",
"right": "0",
"left": "0",
"bottom": "20px"
}
}
}
}
},
"supports": {
"spacing": {
"margin": true
}
},
"supports": {},
"styles": []
}
20 changes: 14 additions & 6 deletions packages/blocks-library/src/submit/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@
"id": {
"type": "string",
"default": ""
},
"style": {
"type": "object",
"default": {
"spacing": {
"margin": {
"top": "0",
"right": "0",
"left": "0",
"bottom": "20px"
}
}
}
}
},
"supports": {
"multiple": false,
"spacing": {
"margin": true,
"padding": true
},
"typography": {
"fontSize": true,
"lineHeight": true
"margin": true
}
},
"styles": []
Expand Down
20 changes: 2 additions & 18 deletions packages/blocks-library/src/submit/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress Dependencies
*/
import { isEmpty, omit, pick } from 'lodash';
import { isEmpty } from 'lodash';
import { __ } from '@wordpress/i18n';
import { useBlockProps } from '@wordpress/block-editor';
/**
Expand All @@ -15,31 +15,15 @@ export default function edit( props ) {
className: classnames( 'cf7-submit-field' ),
} );

const blockPropsWithoutStyles = omit( blockProps, [ 'style' ] );

const { id, label } = props.attributes;

const buttonStyleProps = [
'paddingTop',
'paddingRight',
'paddingBottom',
'paddingLeft',
'padding',
'fontSize',
'lineHeight',
];

return (
<>
<div
{ ...blockPropsWithoutStyles }
style={ omit( blockProps?.style, buttonStyleProps ) }
>
<div { ...blockProps }>
<input
id={ id }
type="submit"
value={ isEmpty( label ) ? 'Submit' : label }
style={ pick( blockProps?.style, buttonStyleProps ) }
/>
</div>
<Inspector { ...props } />
Expand Down

0 comments on commit 5a9635a

Please sign in to comment.