Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wp.blocks.registerBlockType('jack/awardlsblock', {
- title: 'AwardLS Promotion 1x3',
- icon: 'dashicons-welcome-widgets-menus',
- category: 'layout',
- attributes: {
- titleMain: {type: 'string'},
- title1: {type: 'string'},
- content1: {type: 'string'},
- title2: {type: 'string'},
- content2: {type: 'string'},
- title3: {type: 'string'},
- content3: {type: 'string'},
- },
- edit: function(props) {
- function updateContent (event) {
- props.setAttributes({titleMain: event.target.value});
- }
- function updateContent1 (event) {
- props.setAttributes({title1: event.target.value});
- }
- function updateContent2 (event) {
- props.setAttributes({content1: event.target.value});
- }
- function updateContent3 (event) {
- props.setAttributes({title2: event.target.value});
- }
- function updateContent4 (event) {
- props.setAttributes({content2: event.target.value});
- }
- function updateContent5 (event) {
- props.setAttributes({title3: event.target.value});
- }
- function updateContent6 (event) {
- props.setAttributes({content3: event.target.value});
- }
- return React.createElement("div", null, React.createElement("h3", null, "Create a video promotion (1x3 layout)"), React.createElement("p", null, "Three columns with a 2:3:2 width ratio. Centre column reserved for a video showcase."), React.createElement("div", null, React.createElement("p", null, React.createElement("input", {
- type: "text",
- placeholder: "Block title",
- value: props.attributes.titleMain,
- onChange: updateContent
- })), React.createElement("input", {
- type: "text",
- placeholder: "Heading left",
- value: props.attributes.title1,
- onChange: updateContent1
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "Content",
- value: props.attributes.content1,
- onChange: updateContent2,
- cols: '60',
- rows: '3'
- })), React.createElement("div", null, React.createElement("input", {
- type: "text",
- placeholder: "Heading centre",
- value: props.attributes.title2,
- onChange: updateContent3
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "YouTube video URL",
- value: props.attributes.content2,
- onChange: updateContent4,
- cols: '50',
- rows: '1'
- })), React.createElement("div", null, React.createElement("input", {
- type: "text",
- placeholder: "Heading right",
- value: props.attributes.title3,
- onChange: updateContent5
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "Content",
- value: props.attributes.content3,
- onChange: updateContent6,
- cols: '60',
- rows: '3'
- })));;
- },
- save: function (props) {
- return React.createElement("div", {
- class: "container home-2"
- }, React.createElement("h1", null, props.attributes.titleMain), React.createElement("div", null, React.createElement("h2", null, props.attributes.title1), React.createElement("p", null, props.attributes.content1)), React.createElement("div", null, React.createElement("h2", null, props.attributes.title2), React.createElement("iframe", {
- src: props.attributes.content2,
- width: "100%",
- height: "275",
- frameborder: "0"
- })), React.createElement("div", null, React.createElement("h2", null, props.attributes.title3), React.createElement("p", null, props.attributes.content3)));
- }
- })
- wp.blocks.registerBlockType('jack/awardlsblock2'){
- title: 'AwardLS Promotion 1x4 (no header)',
- icon: 'dashicons-welcome-widgets-menus',
- category: 'layout',
- attributes: {
- title1: {type: 'string'},
- content1: {type: 'string'},
- title2: {type: 'string'},
- content2: {type: 'string'},
- title3: {type: 'string'},
- content3: {type: 'string'},
- title4: {type: 'string'},
- content4: {type: 'string'},
- },
- edit: function (props){
- React.createElement("div", null, React.createElement("h3", null, "Create a promotion 1x4"), React.createElement("p", null, "Three columns with a 1:1:1:1 ratio. If you want more rows, add this block type again but don't include a heading!"), React.createElement("div", null, React.createElement("p", null, React.createElement("input", {
- type: "text",
- placeholder: "Block title",
- value: props.attributes.titleMain,
- onChange: updateContent
- })), React.createElement("input", {
- type: "text",
- placeholder: "Heading 1",
- value: props.attributes.title1,
- onChange: updateContent1
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "Content",
- value: props.attributes.content1,
- onChange: updateContent2
- })), React.createElement("div", null, React.createElement("input", {
- type: "text",
- placeholder: "Heading 2",
- value: props.attributes.title2,
- onChange: updateContent3
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "Content",
- value: props.attributes.content2,
- onChange: updateContent4
- })), React.createElement("div", null, React.createElement("input", {
- type: "text",
- placeholder: "Heading 3",
- value: props.attributes.title3,
- onChange: updateContent5
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "Content",
- value: props.attributes.content3,
- onChange: updateContent6
- })), React.createElement("div", null, React.createElement("input", {
- type: "text",
- placeholder: "Heading 4",
- value: props.attributes.title3,
- onChange: updateContent7
- }), React.createElement("br", null), React.createElement("textarea", {
- placeholder: "Content",
- value: props.attributes.content3,
- onChange: updateContent8
- })));
- },
- save: return null,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement