Adds style for loading state of blocks. Removes uncessary enqueues on media component. #607

This commit is contained in:
mateuswetah 2021-10-05 11:37:25 -03:00
parent 0f85cd66cc
commit a440a22d65
9 changed files with 89 additions and 20 deletions

View File

@ -42,7 +42,9 @@ sass -E 'UTF-8' --cache-location .tmp/sass-cache-16 src/views/gutenberg-blocks/t
sass -E 'UTF-8' --cache-location .tmp/sass-cache-17 src/views/gutenberg-blocks/tainacan-blocks/carousel-related-items/style.scss:src/assets/css/tainacan-gutenberg-block-carousel-related-items.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-18 src/views/gutenberg-blocks/gutenberg-blocks-style.scss:src/assets/css/tainacan-gutenberg-block-common-styles.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-18 src/views/gutenberg-blocks/gutenberg-blocks-editor-style.scss:src/assets/css/tainacan-gutenberg-block-common-editor-styles.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-19 src/views/gutenberg-blocks/gutenberg-blocks-theme-style.scss:src/assets/css/tainacan-gutenberg-block-common-theme-styles.css
echo "Compilação do Sass Concluído!"
exit 0

View File

@ -179,4 +179,4 @@
padding: 0 12px;
color: var(--tainacan-block-gray5, #454647); }
/*# sourceMappingURL=tainacan-gutenberg-block-common-styles.css.map */
/*# sourceMappingURL=tainacan-gutenberg-block-common-editor-styles.css.map */

View File

@ -1,7 +1,7 @@
{
"version": 3,
"mappings": "AAIA,KAAM;EACF,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,wBAAwB,CAAC,QAAY;;AAIzC,kDAAmD;EAC/C,WAAW,EAAE,iBAAiB;EAC9B,aAAa,EAAE,YAAY;EAC3B,UAAU,EAAE,oCAAmC;EAE/C,iFAA+B;IAC3B,aAAa,EAAE,CAAC;EAEpB,oFAAkC;IAC9B,OAAO,EAAE,IAA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AAU;MAC3B,WAAW,EAAE,MAAM;MAEnB;;;sHAAI;QACA,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,GAAG;MAEtB;;;wHAAM;QACF,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,GAAG;QAEd,yCAA0C;UAJ9C;;;4HAAM;YAI0C,SAAS,EAAE,GAAG;IAGlE;iJAAmE;MAC/D,SAAS,EAAE,IAAI;MACf,UAAU,EAAE,IAAI;EAGxB,gDAAwB;IACpB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,MAAM;IAEvB,kDAAE;MACE,KAAK,EAAE,oCAAmC;MAC1C,YAAY,EAAE,IAAI;MAClB,UAAU,EAAE,GAAG;EAGvB,2CAAmB;IACf,UAAU,EAAE,iBAAiB;IAC7B,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,aAAa;IAC9B,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,OAAO;IAEf,6CAAE;MACE,OAAO,EAAE,MAAM;MACf,KAAK,EAAE,oCAAmC",
"sources": ["../../views/gutenberg-blocks/gutenberg-blocks-style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
"sources": ["../../views/gutenberg-blocks/gutenberg-blocks-editor-style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-common-styles.css"
"file": "tainacan-gutenberg-block-common-editor-styles.css"
}

View File

@ -0,0 +1,27 @@
[data-module="faceted-search"]:not(.has-mounted),
[data-module="facets-list"]:not(.has-mounted),
[data-module="dynamic-items-list"]:not(.has-mounted),
[data-module="carousel-items-list"]:not(.has-mounted),
[data-module="carousel-terms-list"]:not(.has-mounted),
[data-module="carousel-collections-list"]:not(.has-mounted),
[data-module="item-submission-form"]:not(.has-mounted) {
background-color: inherit;
opacity: 0.75;
border-radius: 2px; }
[data-module="item-submission-form"]:not(.has-mounted),
[data-module="faceted-search"]:not(.has-mounted) {
min-height: 75vh; }
[data-module="facets-list"]:not(.has-mounted),
[data-module="dynamic-items-list"]:not(.has-mounted),
[data-module="carousel-items-list"]:not(.has-mounted),
[data-module="carousel-terms-list"]:not(.has-mounted),
[data-module="carousel-collections-list"]:not(.has-mounted) {
min-height: 160px; }
[data-module="facets-list"]:not(.has-mounted),
[data-module="dynamic-items-list"]:not(.has-mounted) {
min-height: 360px; }
/*# sourceMappingURL=tainacan-gutenberg-block-common-theme-styles.css.map */

View File

@ -0,0 +1,7 @@
{
"version": 3,
"mappings": "AACA;;;;;;sDAMuD;EACnD,gBAAgB,EAAE,OAAO;EACzB,OAAO,EAAE,IAAI;EACb,aAAa,EAAE,GAAG;;AAEtB;gDACiD;EAC7C,UAAU,EAAE,IAAI;;AAEpB;;;;2DAI4D;EACxD,UAAU,EAAE,KAAK;;AAErB;oDACqD;EACjD,UAAU,EAAE,KAAK",
"sources": ["../../views/gutenberg-blocks/gutenberg-blocks-theme-style.scss"],
"names": [],
"file": "tainacan-gutenberg-block-common-theme-styles.css"
}

View File

@ -336,15 +336,6 @@ function tainacan_get_the_media_component(
// Modal lightbox layer for rendering photoswipe
add_action('wp_footer', 'tainacan_get_the_media_modal_layer');
wp_enqueue_script(
'tainacan-blocks-common-theme-scripts',
$TAINACAN_BASE_URL . '/assets/js/tainacan_blocks_common_theme_scripts.js',
array('wp-i18n'),
TAINACAN_VERSION
);
//wp_localize_script('tainacan-blocks-common-theme-scripts', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params());
wp_enqueue_style( 'tainacan-media-component', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-item-gallery.css', array(), TAINACAN_VERSION);
?>
<script>

View File

@ -31,16 +31,16 @@ function tainacan_blocks_initialize() {
// Via Gutenberg filters, we create the Tainacan category
if ( class_exists('WP_Block_Editor_Context') ) { // Introduced WP 5.8
add_filter('block_categories_all', 'tainacan_blocks_register_categories', 10, 2);
add_filter( 'block_categories_all', 'tainacan_blocks_register_categories', 10, 2 );
} else {
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
add_filter( 'block_categories', 'tainacan_blocks_register_categories', 10, 2 );
}
// On the theme side, all we need is the common scripts,
// that handle dynamically the imports using conditioner.js
if ( !is_admin() ) {
add_action('init', 'tainacan_blocks_add_common_theme_scripts', 90);
add_action( 'init', 'tainacan_blocks_add_common_theme_scripts', 90 );
add_action( 'init', 'tainacan_blocks_get_common_theme_styles', 90 );
// On the admin side, we need the blocks registered and their assets (editor-side)
}
add_action('admin_init', 'tainacan_blocks_register_and_enqueue_all_blocks');
@ -134,6 +134,22 @@ function tainacan_blocks_register_block($block_slug, $options = []) {
}
}
/**
* Enqueues the global theme styles necessary for the majority of the blocks
*/
function tainacan_blocks_get_common_theme_styles() {
global $TAINACAN_BASE_URL;
global $TAINACAN_VERSION;
wp_enqueue_style(
'tainacan-blocks-common-theme-styles',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-common-theme-styles.css',
array(),
$TAINACAN_VERSION
);
}
/**
* Enqueues the global editor styles necessary for the majority of the blocks
*/
@ -142,12 +158,11 @@ function tainacan_blocks_get_common_editor_styles() {
global $TAINACAN_VERSION;
wp_enqueue_style(
'tainacan-blocks-common-styles',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-common-styles.css',
'tainacan-blocks-common-editor-styles',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-common-editor-styles.css',
array(),
$TAINACAN_VERSION
);
}
/**

View File

@ -0,0 +1,27 @@
// Empty loading state for Tainacan blocks that are not mounted yet
[data-module="faceted-search"]:not(.has-mounted),
[data-module="facets-list"]:not(.has-mounted),
[data-module="dynamic-items-list"]:not(.has-mounted),
[data-module="carousel-items-list"]:not(.has-mounted),
[data-module="carousel-terms-list"]:not(.has-mounted),
[data-module="carousel-collections-list"]:not(.has-mounted),
[data-module="item-submission-form"]:not(.has-mounted) {
background-color: inherit;
opacity: 0.75;
border-radius: 2px;
}
[data-module="item-submission-form"]:not(.has-mounted),
[data-module="faceted-search"]:not(.has-mounted) {
min-height: 75vh;
}
[data-module="facets-list"]:not(.has-mounted),
[data-module="dynamic-items-list"]:not(.has-mounted),
[data-module="carousel-items-list"]:not(.has-mounted),
[data-module="carousel-terms-list"]:not(.has-mounted),
[data-module="carousel-collections-list"]:not(.has-mounted) {
min-height: 160px;
}
[data-module="facets-list"]:not(.has-mounted),
[data-module="dynamic-items-list"]:not(.has-mounted) {
min-height: 360px;
}