| 1 |
/** |
| 2 |
* External dependencies |
| 3 |
*/ |
| 4 |
import clsx from 'clsx'; |
| 5 |
|
| 6 |
/** |
| 7 |
* WordPress dependencies |
| 8 |
*/ |
| 9 |
import { useBlockProps } from '@wordpress/block-editor'; |
| 10 |
import './editor.scss'; |
| 11 |
import './style.scss'; |
| 12 |
|
| 13 |
import Controls from './controls'; |
| 14 |
import PostCountBlock from './post-count-block'; |
| 15 |
|
| 16 |
export default function Edit( { context, attributes, setAttributes } ) { |
| 17 |
const { textAlign } = attributes; |
| 18 |
|
| 19 |
const blockProps = useBlockProps( { |
| 20 |
className: clsx( 'wp-block-tptn-post-count', 'tptn-post-count', { |
| 21 |
[ `has-text-align-${ textAlign }` ]: textAlign, |
| 22 |
'tptn-advanced-mode': attributes.advancedMode, |
| 23 |
} ), |
| 24 |
} ); |
| 25 |
|
| 26 |
return ( |
| 27 |
<> |
| 28 |
<Controls |
| 29 |
attributes={ attributes } |
| 30 |
setAttributes={ setAttributes } |
| 31 |
/> |
| 32 |
<PostCountBlock |
| 33 |
attributes={ attributes } |
| 34 |
context={ context } |
| 35 |
blockProps={ blockProps } |
| 36 |
/> |
| 37 |
</> |
| 38 |
); |
| 39 |
} |
| 40 |
|