components
7 years ago
styles
6 years ago
edit.js
6 years ago
index.js
7 years ago
index.php
1 week ago
tb_generatecss.js
7 years ago
tb_styling.js
7 years ago
index.js
53 lines
| 1 | /** |
| 2 | * BLOCK: Famous Blog Block Page Grid |
| 3 | */ |
| 4 | |
| 5 | // Import block dependencies and components |
| 6 | import classnames from 'classnames'; |
| 7 | import edit from './edit'; |
| 8 | |
| 9 | // Import CSS |
| 10 | import './styles/style.scss'; |
| 11 | import './styles/editor.scss'; |
| 12 | |
| 13 | // Components |
| 14 | const { __, setLocaleData } = wp.i18n; |
| 15 | |
| 16 | // Extend component |
| 17 | const {Component} = wp.element; |
| 18 | |
| 19 | // Register block controls |
| 20 | const {registerBlockType} = wp.blocks; |
| 21 | |
| 22 | // Register alignments |
| 23 | const validAlignments = ['center', 'wide']; |
| 24 | |
| 25 | export const name = 'core/latest-posts'; |
| 26 | import icons from '../icons/icons'; |
| 27 | |
| 28 | // Register the block |
| 29 | registerBlockType('timeline-blocks/tb-timeline-blocks', { |
| 30 | title: __('Timeline Block'), |
| 31 | description: __('Showcase your posts with a beautiful timeline template.'), |
| 32 | icon: icons.timeline, |
| 33 | category: 'timeline-blocks', |
| 34 | keywords: [ |
| 35 | __('post'), |
| 36 | __('timeline block'), |
| 37 | __('timeline'), |
| 38 | ], |
| 39 | |
| 40 | getEditWrapperProps(attributes) { |
| 41 | const {align} = attributes; |
| 42 | if (-1 !== validAlignments.indexOf(align)) { |
| 43 | return {'data-align': align}; |
| 44 | } |
| 45 | }, |
| 46 | |
| 47 | edit, |
| 48 | |
| 49 | // Render via PHP |
| 50 | save() { |
| 51 | return null; |
| 52 | }, |
| 53 | }); |