diff --git a/images/example-activity.png b/images/example-activity.png new file mode 100644 index 0000000..8608a16 Binary files /dev/null and b/images/example-activity.png differ diff --git a/package.json b/package.json index ed82bae..0f6fff4 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "start": "wp-scripts start" }, "devDependencies": { - "@wordpress/scripts": "6.1.0", - "url-loader": "^3.0.0" + "@wordpress/scripts": "6.1.0" } } diff --git a/src/WPStrava.php b/src/WPStrava.php index 727dcc2..66e7fe6 100644 --- a/src/WPStrava.php +++ b/src/WPStrava.php @@ -215,6 +215,14 @@ class WPStrava { filemtime( WPSTRAVA_PLUGIN_DIR . 'build/style.css' ) ); + wp_localize_script( + 'wp-strava-block', + 'wpStrava', + array( + 'placeholderActivityImg' => WPSTRAVA_PLUGIN_URL . 'images/example-activity.png', + ) + ); + foreach ( $blocks as $block_class ) { $block = new $block_class(); $block->register_block(); diff --git a/src/blocks/activity/index.js b/src/blocks/activity/index.js index 335474b..55978f5 100644 --- a/src/blocks/activity/index.js +++ b/src/blocks/activity/index.js @@ -1,10 +1,18 @@ +/* global wp, wpStrava */ import { registerBlockType } from '@wordpress/blocks'; -import ActivityImage from './activity.png'; + +/** + * Localized Data. + */ +const { + placeholderActivityImg, +} = wpStrava; + registerBlockType( 'wp-strava/activity', { title: 'Strava Activity', icon: 'chart-line', - category: 'widgets', - edit: () => , - save: () =>
Hola, mundo!
, + category: 'embed', + edit: () => , + save: () => , } ); diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 151ae34..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -const defaultConfig = require("./node_modules/@wordpress/scripts/config/webpack.config"); - -module.exports = { - ...defaultConfig, - module: { - ...defaultConfig.module, - rules: [ - ...defaultConfig.module.rules, - { - test: /\.(png|jpg)$/, - use: { - loader: "url-loader" - } - } - ] - } -};