Skip to content

Commit

Permalink
Fix CS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed May 28, 2024
1 parent 2d14e3e commit 1206bce
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 29 deletions.
6 changes: 3 additions & 3 deletions inc/block-styles/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @return void
*/
function register() :void {
function register(): void {
\add_action( 'init', __NAMESPACE__ . '\\bootstrap', 1 );
}

Expand All @@ -29,7 +29,7 @@ function register() :void {
*
* @return void
*/
function bootstrap() :void {
function bootstrap(): void {

// Register A4 portrait block style.
\register_block_style(
Expand All @@ -53,7 +53,7 @@ function bootstrap() :void {
]
);

\add_filter('body_class', __NAMESPACE__ . '\\body_class');
\add_filter( 'body_class', __NAMESPACE__ . '\\body_class' );
}

/**
Expand Down
12 changes: 6 additions & 6 deletions inc/block-variations/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @return void
*/
function register() :void {
function register(): void {
\add_action( 'init', __NAMESPACE__ . '\\register_assets', 5 );
\add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\\enqueue_assets' );
}
Expand All @@ -24,7 +24,7 @@ function register() :void {
*
* @return void
*/
function register_assets() :void {
function register_assets(): void {
\array_map( __NAMESPACE__ . '\\register_asset', get_assets() );
}

Expand All @@ -33,7 +33,7 @@ function register_assets() :void {
*
* @return string[] Array of asset slugs.
*/
function get_assets() : array {
function get_assets(): array {
return [
'label-overview',
];
Expand All @@ -48,7 +48,7 @@ function get_assets() : array {
*
* @return void
*/
function register_asset( string $asset ) : void {
function register_asset( string $asset ): void {

$dir = Label_Printing\DIRECTORY;

Expand Down Expand Up @@ -91,7 +91,7 @@ function register_asset( string $asset ) : void {
*
* @return void
*/
function enqueue_assets() : void {
function enqueue_assets(): void {
\array_map( __NAMESPACE__ . '\\enqueue_asset', get_assets() );
}

Expand All @@ -102,6 +102,6 @@ function enqueue_assets() : void {
*
* @return void
*/
function enqueue_asset( string $asset ) : void {
function enqueue_asset( string $asset ): void {
wp_enqueue_script( "label-printing--$asset" );
}
2 changes: 1 addition & 1 deletion inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @return void
*/
function register() :void {
function register(): void {

\load_plugin_textdomain(
'label-printing',
Expand Down
22 changes: 11 additions & 11 deletions inc/patterns/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @return void
*/
function register() :void {
function register(): void {
\add_action( 'init', __NAMESPACE__ . '\\bootstrap' );
}

Expand All @@ -30,9 +30,9 @@ function register() :void {
*
* @return void
*/
function bootstrap() :void {
function bootstrap(): void {

$store = new Label_Store;
$store = new Label_Store();

// Flush the cache after each import.
\add_action(
Expand All @@ -53,23 +53,23 @@ function bootstrap() :void {
[
// Importantly object refers to a JSON object,
// this is equivalent to an associative array in PHP.
'type' => 'object',
'description' => 'Physical measurements of a printing label.',
'single' => true,
'type' => 'object',
'description' => 'Physical measurements of a printing label.',
'single' => true,
'show_in_rest' => [
'schema' => [
'type' => 'object',
'properties' => [
'width' => [
'width' => [
'type' => 'number',
],
'height' => [
'height' => [
'type' => 'number',
],
'a4_border_tb' => [
'type' => 'number',
],
'a4_border_lr' => [
'a4_border_lr' => [
'type' => 'number',
],
'orientation' => [
Expand All @@ -89,7 +89,7 @@ function bootstrap() :void {
*
* @return void
*/
function register_block_patterns( Label $label ) : void {
function register_block_patterns( Label $label ): void {

// Instantiate new pattern generator.
$generator = new Generator( $label );
Expand Down Expand Up @@ -122,7 +122,7 @@ function register_block_patterns( Label $label ) : void {
*
* @return void
*/
function register_block_pattern_category() : void {
function register_block_pattern_category(): void {
\register_block_pattern_category(
STATIC_PATTERN_CATEGORY,
[
Expand Down
5 changes: 4 additions & 1 deletion src/block-editor/blocks/label-printing/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export default function Edit({
[
'core/paragraph',
{
placeholder: __('Enter label content...', 'label-printing'),
placeholder: __(
'Enter label content…',
'label-printing'
),
style: {
spacing: {
margin: {
Expand Down
2 changes: 1 addition & 1 deletion src/block-editor/blocks/label-printing/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
margin-left: 2vw;

// padding: 20px; // safety disatnce
padding: calc(var(--label-printing-height)*.1) calc(var(--label-printing-width)*.1);
padding: calc(var(--label-printing-height) * 0.1) calc(var(--label-printing-width) * 0.1);
box-sizing: border-box;
}

Expand Down
12 changes: 8 additions & 4 deletions src/block-editor/blocks/label-printing/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,30 @@ body.is-label-printing {
max-width: var(--label-printing-width) !important;

// padding: 20px; // safety disatnce
padding: calc(var(--label-printing-height)*.1) calc(var(--label-printing-width)*.1); // safety disatnce
padding: calc(var(--label-printing-height) * 0.1) calc(var(--label-printing-width) * 0.1); // safety disatnce
box-sizing: border-box;

}

/* // for debug
> .wp-block-group > *:before{
content: var(--label-printing-orientation);
} */
}

@page portrait {
size: A4 portrait;
size: a4 portrait;
page-orientation: upright;
// margin: auto;
}

@page landscape {
size: A4 landscape;
size: a4 landscape;
// page-orientation: rotate-left;
}

@media print {

.is-label-printing {
page: var(--label-printing-orientation);
}
Expand Down
3 changes: 1 addition & 2 deletions src/block-editor/blocks/label-proxy/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @return string
*/
function render() : string {
function render(): string {

$post = \get_post();

Expand Down Expand Up @@ -46,5 +46,4 @@ function render() : string {

// If not already exited.
return '';

}

0 comments on commit 1206bce

Please sign in to comment.