initial commit
This commit is contained in:
commit
83f9473c22
|
@ -0,0 +1,18 @@
|
||||||
|
# This file is for unifying the coding style for different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
# WordPress Coding Standards
|
||||||
|
# https://make.wordpress.org/core/handbook/coding-standards/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Output of `npm pack`
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Output of `wp-scripts plugin-zip`
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "red-orbiter",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "Red Orbiter Block for use with Red Orbital Block.",
|
||||||
|
"author": "The WordPress Contributors",
|
||||||
|
"license": "GPL-2.0-or-later",
|
||||||
|
"main": "build/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "wp-scripts build",
|
||||||
|
"format": "wp-scripts format",
|
||||||
|
"lint:css": "wp-scripts lint-style",
|
||||||
|
"lint:js": "wp-scripts lint-js",
|
||||||
|
"packages-update": "wp-scripts packages-update",
|
||||||
|
"plugin-zip": "wp-scripts plugin-zip",
|
||||||
|
"start": "wp-scripts start"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@wordpress/scripts": "^23.5.0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
=== Red Orbital Orbiter ===
|
||||||
|
Contributors: The WordPress Contributors
|
||||||
|
Tags: block
|
||||||
|
Tested up to: 6.0
|
||||||
|
Stable tag: 0.1.0
|
||||||
|
License: GPL-2.0-or-later
|
||||||
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
Red Orbiter Block for use with Red Orbital Block.
|
||||||
|
|
||||||
|
== Description ==
|
||||||
|
|
||||||
|
This is the long description. No limit, and you can use Markdown (as well as in the following sections).
|
||||||
|
|
||||||
|
For backwards compatibility, if this section is missing, the full length of the short description will be used, and
|
||||||
|
Markdown parsed.
|
||||||
|
|
||||||
|
== Installation ==
|
||||||
|
|
||||||
|
This section describes how to install the plugin and get it working.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
1. Upload the plugin files to the `/wp-content/plugins/red-orbiter` directory, or install the plugin through the WordPress plugins screen directly.
|
||||||
|
1. Activate the plugin through the 'Plugins' screen in WordPress
|
||||||
|
|
||||||
|
|
||||||
|
== Frequently Asked Questions ==
|
||||||
|
|
||||||
|
= A question that someone might have =
|
||||||
|
|
||||||
|
An answer to that question.
|
||||||
|
|
||||||
|
= What about foo bar? =
|
||||||
|
|
||||||
|
Answer to foo bar dilemma.
|
||||||
|
|
||||||
|
== Screenshots ==
|
||||||
|
|
||||||
|
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
|
||||||
|
the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
|
||||||
|
directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
|
||||||
|
(or jpg, jpeg, gif).
|
||||||
|
2. This is the second screen shot
|
||||||
|
|
||||||
|
== Changelog ==
|
||||||
|
|
||||||
|
= 0.1.0 =
|
||||||
|
* Release
|
||||||
|
|
||||||
|
== Arbitrary section ==
|
||||||
|
|
||||||
|
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated
|
||||||
|
plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
|
||||||
|
"installation." Arbitrary sections will be shown below the built-in sections outlined above.
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Plugin Name: Red Orbital Orbiter
|
||||||
|
* Description: Red Orbiter Block for use with Red Orbital Block.
|
||||||
|
* Requires at least: 5.9
|
||||||
|
* Requires PHP: 7.0
|
||||||
|
* Version: 0.1.0
|
||||||
|
* Author: The WordPress Contributors
|
||||||
|
* License: GPL-2.0-or-later
|
||||||
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
* Text Domain: red-orbiter
|
||||||
|
*
|
||||||
|
* @package red-block
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the block using the metadata loaded from the `block.json` file.
|
||||||
|
* Behind the scenes, it registers also all assets so they can be enqueued
|
||||||
|
* through the block editor in the corresponding context.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/reference/functions/register_block_type/
|
||||||
|
*/
|
||||||
|
function red_block_red_orbiter_block_init() {
|
||||||
|
register_block_type( __DIR__ . '/build' );
|
||||||
|
}
|
||||||
|
add_action( 'init', 'red_block_red_orbiter_block_init' );
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
|
"apiVersion": 2,
|
||||||
|
"name": "red-block/red-orbiter",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"title": "Orbiter",
|
||||||
|
"category": "widgets",
|
||||||
|
"icon": "smiley",
|
||||||
|
"description": "Red Orbiter for use with the Red Orbital Block.",
|
||||||
|
"supports": {
|
||||||
|
"html": false
|
||||||
|
},
|
||||||
|
"textdomain": "red-orbiter",
|
||||||
|
"editorScript": "file:./index.js",
|
||||||
|
"editorStyle": "file:./index.css",
|
||||||
|
"style": "file:./style-index.css",
|
||||||
|
"attributes": {
|
||||||
|
"imgSrc": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "https://via.placeholder.com/64x64"
|
||||||
|
},
|
||||||
|
"backgroundColor": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "#ffc8c8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* React hook that is used to mark the block wrapper element.
|
||||||
|
* It provides all the necessary props like the class name.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
|
||||||
|
*/
|
||||||
|
import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
|
||||||
|
import { ColorPicker } from '@wordpress/components';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
|
||||||
|
* Those files can contain any CSS code that gets applied to the editor.
|
||||||
|
*
|
||||||
|
* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
||||||
|
*/
|
||||||
|
import './editor.scss';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The edit function describes the structure of your block in the context of the
|
||||||
|
* editor. This represents what the editor will render when the block is used.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit
|
||||||
|
*
|
||||||
|
* @return {WPElement} Element to render.
|
||||||
|
*/
|
||||||
|
export default function Edit({ attributes, setAttributes }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<InspectorControls>
|
||||||
|
<ColorPicker
|
||||||
|
color={attributes.backgroundColor}
|
||||||
|
onChange={(color) =>
|
||||||
|
setAttributes({backgroundColor: color})
|
||||||
|
}
|
||||||
|
enableAlpha
|
||||||
|
defaultValue="#000"
|
||||||
|
/>
|
||||||
|
</InspectorControls>
|
||||||
|
|
||||||
|
<li { ...useBlockProps({
|
||||||
|
className: 'orbital',
|
||||||
|
style: {
|
||||||
|
color: attributes.backgroundColor,
|
||||||
|
}
|
||||||
|
}) }>
|
||||||
|
<div className="orbital-content content-center anti-clockwise">
|
||||||
|
<div className="feature">
|
||||||
|
<div className="feature-item primary">
|
||||||
|
<img className="img" src={attributes.imgSrc} />
|
||||||
|
</div>
|
||||||
|
<div className="feature-item secondary">
|
||||||
|
<p>Hallo!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* The following styles get applied inside the editor only.
|
||||||
|
*
|
||||||
|
* Replace them with your own styles or remove the file completely.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.wp-block-red-block-red-orbiter {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
list-style: none;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
z-index: 10;
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .orbital-content {
|
||||||
|
z-index: 20;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-item {
|
||||||
|
margin: 16px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**
|
||||||
|
* Registers a new block provided a unique name and an object defining its behavior.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||||
|
*/
|
||||||
|
import { registerBlockType } from '@wordpress/blocks';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
|
||||||
|
* All files containing `style` keyword are bundled together. The code used
|
||||||
|
* gets applied both to the front of your site and to the editor.
|
||||||
|
*
|
||||||
|
* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
||||||
|
*/
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import Edit from './edit';
|
||||||
|
import save from './save';
|
||||||
|
import metadata from './block.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Every block starts by registering a new block type definition.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||||
|
*/
|
||||||
|
registerBlockType( metadata.name, {
|
||||||
|
/**
|
||||||
|
* @see ./edit.js
|
||||||
|
*/
|
||||||
|
edit: Edit,
|
||||||
|
/**
|
||||||
|
* @see ./save.js
|
||||||
|
*/
|
||||||
|
save,
|
||||||
|
} );
|
|
@ -0,0 +1,34 @@
|
||||||
|
/**
|
||||||
|
* Retrieves the translation of text.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
|
||||||
|
*/
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* React hook that is used to mark the block wrapper element.
|
||||||
|
* It provides all the necessary props like the class name.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
|
||||||
|
*/
|
||||||
|
import { useBlockProps } from '@wordpress/block-editor';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The save function defines the way in which the different attributes should
|
||||||
|
* be combined into the final markup, which is then serialized by the block
|
||||||
|
* editor into `post_content`.
|
||||||
|
*
|
||||||
|
* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#save
|
||||||
|
*
|
||||||
|
* @return {WPElement} Element to render.
|
||||||
|
*/
|
||||||
|
export default function save() {
|
||||||
|
return (
|
||||||
|
<p { ...useBlockProps.save() }>
|
||||||
|
{ __(
|
||||||
|
'Red Orbital Orbiter – hello from the saved content!',
|
||||||
|
'red-orbiter'
|
||||||
|
) }
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
/**
|
||||||
|
* 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-red-block-red-orbiter {
|
||||||
|
}
|
Reference in New Issue