Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed May 7, 2021
1 parent 1b5f26c commit d1d6bd8
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 53 deletions.
40 changes: 20 additions & 20 deletions block.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"apiVersion": 2,
"name": "frontity/frontity-slot",
"title": "Frontity Slot",
"category": "embed",
"description": "Insert a Frontity Slot",
"supports": {
"html": false
},
"textdomain": "frontity-slot",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"attributes": {
"name": {
"type": "string",
"source": "attribute",
"selector": "div",
"attribute": "data-frontity-slot-name",
"default": ""
}
}
"apiVersion": 2,
"name": "frontity/frontity-slot",
"title": "Frontity Slot",
"category": "embed",
"description": "Insert a Frontity Slot",
"supports": {
"html": false
},
"textdomain": "frontity-slot",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"attributes": {
"name": {
"type": "string",
"source": "attribute",
"selector": "div",
"attribute": "data-frontity-slot-name",
"default": ""
}
}
}
36 changes: 18 additions & 18 deletions src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import { Icon, next } from "@wordpress/icons";
import "./editor.scss";

export default function FrontitySlotEdit({ attributes, setAttributes }) {
const instanceId = useInstanceId(FrontitySlotEdit);
const inputId = `blocks-frontity-slot-${instanceId}`;
const instanceId = useInstanceId(FrontitySlotEdit);
const inputId = `blocks-frontity-slot-${instanceId}`;

return (
<div {...useBlockProps({ className: "components-placeholder" })}>
<label htmlFor={inputId} className="components-placeholder__label">
<Icon icon={next} />
{__("Frontity Slot")}
</label>
<PlainText
className="blocks-frontity-slot-name__textarea"
id={inputId}
value={attributes.name}
aria-label={__("Frontity Slot name")}
placeholder={__("Write the name of the Slot here…")}
onChange={(name) => setAttributes({ name })}
/>
</div>
);
return (
<div {...useBlockProps({ className: "components-placeholder" })}>
<label htmlFor={inputId} className="components-placeholder__label">
<Icon icon={next} />
{__("Frontity Slot")}
</label>
<PlainText
className="blocks-frontity-slot-name__textarea"
id={inputId}
value={attributes.name}
aria-label={__("Frontity Slot name")}
placeholder={__("Write the name of the Slot here…")}
onChange={(name) => setAttributes({ name })}
/>
</div>
);
}
12 changes: 6 additions & 6 deletions src/editor.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[data-type="frontity/frontity-slot"] {
.block-editor-plain-text {
max-height: 250px;
}
.block-editor-plain-text {
max-height: 250px;
}

&.components-placeholder {
min-height: 0;
}
&.components-placeholder {
min-height: 0;
}
}
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import edit from "./edit";
import save from "./save";

registerBlockType("frontity/frontity-slot", {
icon: next,
edit,
save,
icon: next,
edit,
save,
});
12 changes: 6 additions & 6 deletions src/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { __ } from "@wordpress/i18n";
import { useBlockProps } from "@wordpress/block-editor";

export default function save({ attributes }) {
return (
<div
{...useBlockProps.save()}
data-frontity-slot-name={attributes.name}
></div>
);
return (
<div
{...useBlockProps.save()}
data-frontity-slot-name={attributes.name}
></div>
);
}

0 comments on commit d1d6bd8

Please sign in to comment.