Added skeletal activity block

This commit is contained in:
Justin Foell
2019-12-27 14:40:27 -06:00
parent 8a6e04e27c
commit c997738470
8 changed files with 12587 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-blocks', 'wp-element', 'wp-polyfill'), 'version' => '75cbab21f59424fbb0a36e9cf02ba1af');
+1
View File
@@ -0,0 +1 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);Object(o.registerBlockType)("wp-strava/activity",{title:"Strava Activity",icon:"smiley",category:"widgets",edit:function(){return Object(r.createElement)("div",null,"Hola, mundo!")},save:function(){return Object(r.createElement)("div",null,"Hola, mundo!")}})}]);
+9
View File
@@ -0,0 +1,9 @@
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-wp-strava-activity {
border: 1px dotted #f00;
}
+50
View File
@@ -0,0 +1,50 @@
<?php
/**
* Functions to register client-side assets (scripts and stylesheets) for the
* Gutenberg block.
*
* @package wp-strava
*/
/**
* Registers all block assets so that they can be enqueued through Gutenberg in
* the corresponding context.
*
* @see https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type/#enqueuing-block-scripts
*/
function register_activity_block() {
// automatically load dependencies and version
$asset_file = include plugin_dir_path( __FILE__ ) . 'build/index.asset.php';
wp_register_script(
'wp-strava/activity',
plugins_url( 'build/index.js', __FILE__ ),
$asset_file['dependencies'],
$asset_file['version']
);
wp_register_style(
'wp-strava/activity',
plugins_url( 'style.css', __FILE__ ),
array(),
filemtime( plugin_dir_path( __FILE__ ) . 'style.css' )
);
register_block_type(
'wp-strava/activity',
array(
'style' => 'wp-strava/activity',
'editor_script' => 'wp-strava/activity',
)
);
if ( function_exists( 'wp_set_script_translations' ) ) {
/**
* May be extended to wp_set_script_translations( 'my-handle', 'my-domain',
* plugin_dir_path( MY_PLUGIN ) . 'languages' ) ). For details see
* https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/
*/
wp_set_script_translations( 'wp-strava/activity', 'wp-strava' );
}
}
add_action( 'init', 'register_activity_block' );
+12493
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -0,0 +1,13 @@
{
"name": "activity",
"version": "1.0.0",
"license": "GPL-2.0-or-later",
"description": "",
"main": "build/index.js",
"scripts": {
"build": "wp-scripts build"
},
"devDependencies": {
"@wordpress/scripts": "6.1.0"
}
}
+9
View File
@@ -0,0 +1,9 @@
import { registerBlockType } from '@wordpress/blocks';
registerBlockType( 'wp-strava/activity', {
title: 'Strava Activity',
icon: 'smiley',
category: 'widgets',
edit: () => <div>Hola, mundo!</div>,
save: () => <div>Hola, mundo!</div>,
} );
+11
View File
@@ -0,0 +1,11 @@
/**
* The following styles get applied both on the front of your site and in the editor.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-wp-strava-activity {
background-color: #000;
color: #fff;
padding: 2px;
}