Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
open-source
hacklab-blocks
Commits
813abfbb
Commit
813abfbb
authored
3 years ago
by
everaldomatias
Browse files
Options
Download
Email Patches
Plain Diff
WIP - Init block Geo Information
parent
02012507
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
21669 additions
and
90 deletions
+21669
-90
blocks/geo-information/README.md
blocks/geo-information/README.md
+11
-0
blocks/geo-information/block.json
blocks/geo-information/block.json
+24
-0
blocks/geo-information/edit.js
blocks/geo-information/edit.js
+37
-0
blocks/geo-information/editor.scss
blocks/geo-information/editor.scss
+13
-0
blocks/geo-information/geo-information.php
blocks/geo-information/geo-information.php
+11
-0
blocks/geo-information/index.js
blocks/geo-information/index.js
+47
-0
blocks/geo-information/save.js
blocks/geo-information/save.js
+23
-0
blocks/geo-information/style.scss
blocks/geo-information/style.scss
+6
-0
hacklab-blocks.php
hacklab-blocks.php
+4
-1
package-lock.json
package-lock.json
+21493
-89
No files found.
blocks/geo-information/README.md
0 → 100644
View file @
813abfbb
# Informação geolocalizada (geo information)
## Descrição
Bloco para geolocalização de informações.
## Como usar
## Changelog
1.
0.0 - versão inicial
\ No newline at end of file
This diff is collapsed.
Click to expand it.
blocks/geo-information/block.json
0 → 100755
View file @
813abfbb
{
"$schema"
:
"https://schemas.wp.org/trunk/block.json"
,
"apiVersion"
:
2
,
"name"
:
"hacklab-blocks/geo-information"
,
"version"
:
"1.0.0"
,
"title"
:
"Geo information"
,
"category"
:
"text"
,
"icon"
:
"admin-site"
,
"description"
:
"Bloco para geolocalização de informações"
,
"attributes"
:
{
"message"
:
{
"type"
:
"string"
,
"source"
:
"text"
,
"selector"
:
"div"
}
},
"supports"
:
{
"html"
:
false
},
"textdomain"
:
"hacklab-blocks"
,
"editorScript"
:
"file:../../build/js/geo-information-index/geo-information-index.js"
,
"editorStyle"
:
"file:../../build/css/geo-information-index.css"
,
"style"
:
"file:../../build/css/style-geo-information-index.css"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
blocks/geo-information/edit.js
0 → 100755
View file @
813abfbb
/**
* WordPress components that create the necessary UI elements for the block
*
* @see https://developer.wordpress.org/block-editor/packages/packages-components/
*/
import
{
TextControl
}
from
'
@wordpress/components
'
;
/**
* 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 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
*
* @param {Object} props Properties passed to the function.
* @param {Object} props.attributes Available block attributes.
* @param {Function} props.setAttributes Function that updates individual attributes.
*
* @return {WPElement} Element to render.
*/
export
default
function
Edit
(
{
attributes
,
setAttributes
}
)
{
const
blockProps
=
useBlockProps
();
return
(
<
TextControl
{
...
blockProps
}
value
=
{
attributes
.
message
}
onChange
=
{
(
val
)
=>
setAttributes
(
{
message
:
val
}
)
}
/
>
);
}
This diff is collapsed.
Click to expand it.
blocks/geo-information/editor.scss
0 → 100755
View file @
813abfbb
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-gutenpride
input
[
type
=
'text'
]
{
font-family
:
Gilbert
;
font-size
:
64px
;
color
:
inherit
;
background
:
inherit
;
border
:
0
;
}
This diff is collapsed.
Click to expand it.
blocks/geo-information/geo-information.php
0 → 100644
View file @
813abfbb
<?php
namespace
hacklabBlocks
;
/**
* Geo information render_callback
*/
function
geo_information_callback
(
$attributes
,
$content
,
$block
)
{
return
'<div class="wp-block-hacklab-geo-information">Geo information</div>'
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
blocks/geo-information/index.js
0 → 100755
View file @
813abfbb
/**
* Registers a new block provided a unique name and an object defining its behavior.
*
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
*/
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. All other files
* get applied to the editor only.
*
* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
*/
import
'
./style.scss
'
;
import
'
./editor.scss
'
;
/**
* Internal dependencies
*/
import
Edit
from
'
./edit
'
;
import
save
from
'
./save
'
;
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
*/
registerBlockType
(
'
hacklab-blocks/geo-information
'
,
{
/**
* Used to construct a preview for the block to be shown in the block inserter.
*/
example
:
{
attributes
:
{
message
:
'
Gutenpride
'
,
},
},
/**
* @see ./edit.js
*/
edit
:
Edit
,
/**
* @see ./save.js
*/
save
,
}
);
This diff is collapsed.
Click to expand it.
blocks/geo-information/save.js
0 → 100755
View file @
813abfbb
/**
* 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
*
* @param {Object} props Properties passed to the function.
* @param {Object} props.attributes Available block attributes.
* @return {WPElement} Element to render.
*/
export
default
function
save
(
{
attributes
}
)
{
const
blockProps
=
useBlockProps
.
save
();
return
<
div
{
...
blockProps
}
>
{
attributes
.
message
}
<
/div>
;
}
This diff is collapsed.
Click to expand it.
blocks/geo-information/style.scss
0 → 100755
View file @
813abfbb
/**
* 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.
*/
This diff is collapsed.
Click to expand it.
hacklab-blocks.php
View file @
813abfbb
...
...
@@ -33,7 +33,10 @@ function hacklab_blocks_init() {
),
'featured-color'
=>
array
(
'render_callback'
=>
'hacklabBlocks\\featured_color_callback'
)
),
'geo-information'
=>
array
(
'render_callback'
=>
'hacklabBlocks\\geo_information_callback'
),
);
$blocos_ativos
=
apply_filters
(
'hacklab_blocos_ativos'
,
$blocos_ativos
);
foreach
(
$blocos_ativos
as
$block_name
=>
$block_args
)
{
...
...
This diff is collapsed.
Click to expand it.
package-lock.json
View file @
813abfbb
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment