Skip to content

Commit

Permalink
Performing Housekeeping (a8cteam51#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
TremiDkhar committed Nov 4, 2024
1 parent 8674f07 commit 28e5fb7
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 74 deletions.
56 changes: 27 additions & 29 deletions block/block.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "team51/colophon",
"version": "0.1.0",
"title": "Colophon",
"category": "common",
"icon": "editor-textcolor",
"description": "A block for displaying a colophon.",
"supports": {
"html": false,
"align": true,
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontFamily": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"textdomain": "team51-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"render": "file:./render.php"
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "team51/colophon",
"version": "0.1.0",
"title": "Colophon",
"category": "theme",
"icon": "editor-textcolor",
"description": "A block for displaying a colophon.",
"supports": {
"html": false,
"align": true,
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontFamily": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"textdomain": "team51-blocks",
"editorScript": "file:./index.js",
"render": "file:./render.php"
}
24 changes: 12 additions & 12 deletions block/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* Retrieves the translation of text.
* Import the ServerSideRender component from the @wordpress/server-side-render package.
* This component is used to render the block on the server side.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-server-side-render/
*/
import ServerSideRender from "@wordpress/server-side-render";

Expand All @@ -14,12 +15,8 @@ import ServerSideRender from "@wordpress/server-side-render";
import { useBlockProps } from "@wordpress/block-editor";

/**
* 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 the block.json to get the block meta.
*/
import "./editor.scss";
import blockMeta from "./block.json";

/**
Expand All @@ -31,9 +28,12 @@ import blockMeta from "./block.json";
* @return {WPElement} Element to render.
*/
export default function Edit(props) {
return (
<div {...useBlockProps()}>
<ServerSideRender block={blockMeta.name} attributes={props.attributes} />
</div>
);
return (
<div {...useBlockProps()}>
<ServerSideRender
block={blockMeta.name}
attributes={props.attributes}
/>
</div>
);
}
5 changes: 0 additions & 5 deletions block/editor.scss

This file was deleted.

25 changes: 8 additions & 17 deletions block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
*/
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
*/
Expand All @@ -26,13 +17,13 @@ import metadata from "./block.json";
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
registerBlockType(metadata.name, {
/**
* @see ./edit.js
*/
edit: Edit,
/**
* @see ./edit.js
*/
edit: Edit,

/**
* @see ./save.js
*/
save: () => null,
/**
* @see ./save.js
*/
save: () => null,
});
6 changes: 0 additions & 6 deletions block/style.scss

This file was deleted.

4 changes: 1 addition & 3 deletions build/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "team51/colophon",
"version": "0.1.0",
"title": "Colophon",
"category": "common",
"category": "theme",
"icon": "editor-textcolor",
"description": "A block for displaying a colophon.",
"supports": {
Expand All @@ -25,7 +25,5 @@
},
"textdomain": "team51-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"render": "file:./render.php"
}
8 changes: 8 additions & 0 deletions build/index-rtl.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*!******************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./block/editor.scss ***!
\******************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-server-side-render'), 'version' => '769da1ae48da0e34a83e');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-server-side-render'), 'version' => '9e2f6c13ff86f54b1a55');
9 changes: 9 additions & 0 deletions build/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 28e5fb7

Please sign in to comment.