Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@df6cc6d from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Mar 7, 2024
1 parent 6307c72 commit 1a3dc16
Show file tree
Hide file tree
Showing 45 changed files with 20,288 additions and 197 deletions.
2 changes: 1 addition & 1 deletion blocks/core-navigation/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-blocks', 'wp-dom-ready', 'wp-hooks'), 'version' => '56c83ed099664c81616b');
<?php return array('dependencies' => array('wp-blocks', 'wp-dom-ready'), 'version' => 'd2f8f6f34180ea92f25c');
2 changes: 1 addition & 1 deletion blocks/core-navigation/build/index.js

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

2 changes: 1 addition & 1 deletion blocks/core-navigation/build/style-index.css

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

20 changes: 0 additions & 20 deletions blocks/core-navigation/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* WordPress Dependencies
*/
import { addFilter } from '@wordpress/hooks';
import domReady from '@wordpress/dom-ready';
import { registerBlockStyle, unregisterBlockStyle } from '@wordpress/blocks';

Expand Down Expand Up @@ -30,22 +29,3 @@ domReady(() => {
label: 'Divided Links',
});
});

addFilter(
'blocks.registerBlockType',
'prc-core-navigation-allowedblocks',
(settings, name) => {
if (name === 'core/navigation') {
return {
...settings,
allowedBlocks: [
...(settings.allowedBlocks ?? []),
'prc-user-accounts/login-logout',
'prc-block/logo',
'prc-block/navigation-mega-menu',
],
};
}
return settings;
}
);
30 changes: 3 additions & 27 deletions blocks/core-navigation/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@


.wp-block-navigation.is-style-mega-menu {
margin-left: -1em!important;
margin-right: -1em!important;
max-width: calc(var(--wp--style--global--wide-size) + 2em)!important;
width: 100%;
position: relative;
.wp-block-navigation__container {
width: 100%;
}
.wp-block-navigation-item {
display: flex;
flex-grow: 1;
Expand All @@ -68,27 +68,3 @@
padding: 1em!important;
}
}
.wp-block-group:has( > .wp-block-navigation.is-style-mega-menu) {
display: flex;
justify-content: center;
}




// Main Mobile Menu Styling

.wp-block-navigation.is-style-mega-mobile-menu:has(.wp-block-navigation__responsive-container.is-menu-open) {
// .wp-block-navigation__responsive-container-open {
// &:after {
// content: "X"
// }
// svg {
// display: none;
// }
// }
.wp-block-navigation__responsive-container {
top: 50px;
}
}

21 changes: 10 additions & 11 deletions blocks/core-query/core-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ public function __construct($loader) {

public function init($loader = null) {
if ( null !== $loader ) {
$loader->add_action('init', $this, 'register_assets');
$loader->add_action('init', $this, 'hard_enable_enhanced_pagination', 100);
$loader->add_action('enqueue_block_editor_assets', $this, 'register_editor_script');
$loader->add_filter('prc_platform_pub_listing_default_args', $this, 'set_starting_defaults_for_pub_listing_query_args', 1, 1);
// $this->loader->add_filter( 'pre_render_block', $core_query, 'filter_pub_listing_query_args', 10, 3);
$loader->add_action( 'init', $this, 'register_assets' );
$loader->add_action( 'init', $this, 'hard_enable_enhanced_pagination', 100 );
$loader->add_action( 'enqueue_block_editor_assets', $this, 'register_editor_script');
$loader->add_filter( 'prc_platform_pub_listing_default_args', $this, 'set_starting_defaults_for_pub_listing_query_args', 1, 1 );
$loader->add_filter( 'pre_render_block', $this, 'filter_pub_listing_query_args', 10, 3 );

$loader->add_filter( 'render_block_data', $this, 'default_enhanced_pagination_on', 1001, 1);
$loader->add_filter('render_block_context', $this, 'hijack_query_block_context', 100, 3);
$loader->add_filter( 'render_block_data', $this, 'default_enhanced_pagination_on', 1001, 1 );
$loader->add_filter( 'render_block_context', $this, 'hijack_query_block_context', 100, 3 );

$loader->add_filter( 'rest_post_query', $this, 'filter_pub_listing_rest_query', 10, 2 );
// $this->loader->add_filter( 'query_loop_block_query_vars', $core_query, 'filter_pub_listing_query_args', 10, 2 );
$loader->add_action('pre_get_posts', $this, 'set_starting_defaults_for_post_type_for_pre_get_posts', 10, 1);
$loader->add_filter( 'block_type_metadata', $this, 'default_tax_query_to_OR', 100, 1);
$loader->add_action( 'pre_get_posts', $this, 'set_starting_defaults_for_post_type_for_pre_get_posts', 10, 1 );
$loader->add_filter( 'block_type_metadata', $this, 'default_tax_query_to_OR', 100, 1 );
$loader->add_filter( 'block_type_metadata_settings', $this, 'update_context', 100, 2 );
}
}
Expand Down Expand Up @@ -138,7 +137,7 @@ public function filter_pub_listing_query_args($pre_render, $parsed_block, $paren
return $pre_render;
}
$attributes = $parsed_block[ 'attrs' ] ?? array();
if( array_key_exists('namespace',$attributes) && 'prc-block/pub-listing-query' === $attributes['namespace'] ) {
if( array_key_exists('namespace', $attributes) && 'prc-block/pub-listing-query' === $attributes['namespace'] ) {
add_filter(
'query_loop_block_query_vars',
function( $query, $block, $page ) {
Expand Down
29 changes: 19 additions & 10 deletions blocks/core-query/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ const PublicationListingTemplate = [
{
showLabel: true,
},
]
],
];

/**
* Publication Listing Query
* Changes the default query to only include posts that are published and have a parent, also sets the default post types to post, short-read, fact-sheet, interactives, and quizzes.
*/
const NAMESPACE = "prc-block/pub-listing-query"
const NAMESPACE = 'prc-block/pub-listing-query';
const pubListingVariation = {
name: NAMESPACE,
title: 'Publication Listing Query',
description:
'Query posts in the style of a "Publication Listing".',
description: 'Query posts in the style of a "Publication Listing".',
attributes: {
namespace: NAMESPACE,
query: {
Expand All @@ -55,8 +54,15 @@ const pubListingVariation = {
},
enhancedPagination: true,
},
allowedControls: ['order', 'taxQuery', 'search', 'author', 'sticky', 'inherit'],
isActive: ({query}) => {
allowedControls: [
'order',
'taxQuery',
'search',
'author',
'sticky',
'inherit',
],
isActive: ({ query }) => {
return query.isPubListingQuery;
},
innerBlocks: PublicationListingTemplate,
Expand All @@ -78,14 +84,17 @@ addFilter(
if (BLOCKNAME !== name || namespace !== NAMESPACE) {
return <BlockEdit {...props} />;
}
const blockAreaContextPostIds = useSelect(select => {
return select('prc-platform/block-area-context').getPostIds()
const blockAreaContextPostIds = useSelect((select) => {
return select('prc-platform/block-area-context').getPostIds();
});

const tmpExclude = attributes.query?.exclude || [];
attributes.query.exclude = [...blockAreaContextPostIds, ...tmpExclude];
attributes.query.exclude = [
...blockAreaContextPostIds,
...tmpExclude,
];

return <BlockEdit {...props}/>;
return <BlockEdit {...props} />;
};
}, 'withBlockAreaContextWatcher')
);
4 changes: 2 additions & 2 deletions blocks/grid-controller/src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"apiVersion": 3,
"name": "prc-block/grid-controller",
"version": "0.1.0",
"title": "Grid",
"title": "Grid Controller",
"category": "design",
"description": "Display content in multiple columns using CSS grid with blocks added to each column.",
"description": "Layout content in columns using custom PRC grid system.",
"keywords": [
"grid",
"columns",
Expand Down
16 changes: 11 additions & 5 deletions blocks/logo/build/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "prc-block/logo",
"version": "1.0.0",
"title": "Pew Research Center Logo",
"description": "Contextually aware logo that has dark mode support, and will change to the alternate position logo in smaller containers. (#dark-mode, #css-container-queries)",
"description": "Contextually aware logo block for Pew Research Center. Can display either the standard PRC logo set or Decoded logo.",
"category": "theme",
"keywords": [
"logo",
Expand All @@ -19,16 +19,16 @@
},
"justification": {
"type": "string",
"default": "left",
"enum": [
"left",
"center",
"right"
],
"default": "left"
]
},
"width": {
"type": "number",
"default": 360
"default": 280
}
},
"supports": {
Expand Down Expand Up @@ -61,7 +61,13 @@
"label": "Decoded"
}
],
"example": {},
"example": {
"viewportWidth": 400,
"attributes": {
"width": 300,
"className": "block-editor-block-types-list__prc-logo-example"
}
},
"usesContext": [
"postType",
"postId",
Expand Down
2 changes: 1 addition & 1 deletion blocks/logo/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('classnames', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-polyfill'), 'version' => 'e14eaee38624a24afc15');
<?php return array('dependencies' => array('classnames', 'prc-hooks', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-hooks', 'wp-polyfill'), 'version' => 'a44452713f47297f687d');
2 changes: 1 addition & 1 deletion blocks/logo/build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blocks/logo/build/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 1a3dc16

Please sign in to comment.