Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/WDS-BT-V1 #26

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
24c0cbe
Add static block variation and update create block script
khleomix Jun 19, 2024
c5a753c
WDSBT-23 - Override WP Query to respect perPage count even with stick…
khleomix Jun 19, 2024
fc74e7d
WDSBT-23 - modify query for related posts block, exclude current post…
khleomix Jun 19, 2024
4cf83c9
WDSBT-23 - Update ignore files to only track the assets/blocks folder
khleomix Jun 19, 2024
4b1c299
WDSBT-23 - Add related posts pattern and primary category pattern
khleomix Jun 19, 2024
00275c4
WDSBT-23 - Transfer related posts pattern registration
khleomix Jun 19, 2024
f5f9b36
WDSBT-23 - Clean up webpack
khleomix Jun 27, 2024
a36838e
WDSBT-23 - Update Single template with patterns and related posts pat…
khleomix Jun 27, 2024
bf75525
WDSBT-23 - Add buttons size filter
khleomix Jun 27, 2024
2a3cd2d
WDSBT-23 - Button styles IN PROGRESS
khleomix Jun 28, 2024
a045c41
Merge branch 'main' into feature/WDSBT-23-Query-Block-Related-Post-Block
khleomix Jul 3, 2024
d3f0cc0
WDSBT-23 - Fix webpack config - hotfix
khleomix Jul 3, 2024
73ae48d
Merge branch 'main' into feature/WDSBT-23-Query-Block-Related-Post-Block
khleomix Jul 15, 2024
aba8563
WDSBT-23 - Update lock files
khleomix Jul 15, 2024
e09387e
WDSBT-23 - Update packages
khleomix Jul 15, 2024
927bb1c
WDSBT-23 - Update composer packages
khleomix Jul 15, 2024
245032d
WDSBT-23 - Fix theme.json error
khleomix Jul 15, 2024
481f182
WDSBT-23 - Fix font error, and style post meta
khleomix Jul 15, 2024
1d0f69d
WDSBT-23 - Adjust related posts pattern and styles
khleomix Jul 15, 2024
d168d8e
WDSBT-23 - Adjust related posts pattern and styles
khleomix Jul 15, 2024
a46f67d
WDSBT-23 - Fix linting errors
khleomix Jul 15, 2024
6fc766f
WDSBT-23 - Update related posts style
khleomix Jul 22, 2024
1026d91
WDSBT-23 - Fix themejson for v3
khleomix Jul 24, 2024
6a2dfe5
Remove template lock on header and footer
khleomix Aug 7, 2024
6503117
Update workflow to only run on pull requests
khleomix Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/workflows/assertions.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Code Quality

on:
pull_request:
push:
branches:
- main
pull_request:
branches:
- main

# Cancel previous workflow run groups that have not completed.
concurrency:
# Group workflow runs by workflow name, along with the head branch ref of the pull request
# or otherwise the branch or tag ref.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint-css:
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
name: Security

on:
# Run on all pushes and on all pull requests.
push:
pull_request:
# Also run this workflow every Monday at 6:00.
schedule:
- cron: '0 6 * * 1'
# Allow manually triggering the workflow.
workflow_dispatch:
pull_request:
branches:
- main

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
security:
Expand Down
2 changes: 1 addition & 1 deletion .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blocks
./blocks
build
node_modules
vendor
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blocks/
./blocks/
build/
node_modules/
vendor/
Expand Down
101 changes: 101 additions & 0 deletions assets/js/block-filters/buttons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { addFilter } from '@wordpress/hooks';
import { createHigherOrderComponent } from '@wordpress/compose';
import { InspectorControls } from '@wordpress/block-editor';
import {
PanelBody,
PanelRow,
ButtonGroup,
Button,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Renders the edit component for the button block.
*
* @param {Object} props - The properties passed to the component.
* @param {Object} props.attributes - The attributes of the button block.
* @param {string} props.attributes.buttonSize - The size of the button.
* @param {Function} props.setAttributes - The function to set the attributes of the button block.
* @return {JSX.Element} The rendered edit component.
*/
function Edit({ attributes: { buttonSize }, setAttributes }) {
const handleChange = (newSize) => {
// Check if we are toggling the size off
const size = buttonSize === newSize ? undefined : newSize;
const buttonClass = buttonSize !== newSize ? 'has-size-' + newSize : '';

// Update attributes.
setAttributes({
buttonSize: size,
className: buttonClass,
});
};

return (
<InspectorControls>
<PanelBody title={__('Button Sizes')}>
<PanelRow>
<ButtonGroup aria-label={__('Button Sizes')}>
{['s', 'm', 'l', 'xl'].map((sizeValue) => {
return (
<Button
key={sizeValue}
size="medium"
variant={
buttonSize === sizeValue
? 'primary'
: undefined
}
onClick={() => handleChange(sizeValue)}
>
{sizeValue.toUpperCase()}
</Button>
);
})}
</ButtonGroup>
</PanelRow>
</PanelBody>
</InspectorControls>
);
}

addFilter(
'blocks.registerBlockType',
'wds-bt/button-sizes',
(settings, name) => {
if (name !== 'core/button') {
return settings;
}

return {
...settings,
attributes: {
...settings.attributes,
buttonSize: {
type: 'string',
selector: 'a',
default: '',
},
},
};
}
);

addFilter(
'editor.BlockEdit',
'wds-bt/button-sizes',
createHigherOrderComponent((BlockEdit) => {
return (props) => {
if (props.name !== 'core/button') {
return <BlockEdit {...props} />;
}

return (
<>
<BlockEdit {...props} />
<Edit {...props} />
</>
);
};
})
);
1 change: 1 addition & 0 deletions assets/js/block-filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

// Import the block filter file.
import './unregister-core-embed';
import './buttons';
4 changes: 2 additions & 2 deletions assets/scss/blocks/core/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}
}

&.large {
&.has-size-l {
.wp-block-button__link {
border-radius: 6px;
border-width: 2px;
Expand All @@ -78,7 +78,7 @@
}
}

&.xlarge {
&.has-size-xl {
.wp-block-button__link {
border-radius: 6px;
border-width: 2px;
Expand Down
1 change: 1 addition & 0 deletions assets/scss/patterns/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// 'patterns/' houses styles for custom patterns.
// @import './pattern-name';
@import './related-posts';
76 changes: 76 additions & 0 deletions assets/scss/patterns/related-posts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/** cards **/

.related-posts-query {
.wp-block-post {
border-radius: 10px;
box-shadow:
0 0.5rem 1rem 0 rgba(48, 49, 51, 0.1),
0 0 0.0625rem 0 rgba(48, 49, 51, 0.05);

> *:not(.wp-block-post-featured-image):not(hr) {
padding: 0.5rem 1.875rem;
}

.wp-block-post-featured-image {
img {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
}

.wp-block-post-terms {
padding-bottom: 0;

a {
color: var(--wp--preset--color--grey-400);
padding-bottom: 0;
text-transform: none;

&:hover,
&:focus {
color: var(--wp--preset--color--primary-500);
}
}
}

.wp-block-post-title {
margin: 0;

a {
color: var(--wp--preset--color--black);
font-size: var(--wp--preset--font-size--l);
line-height: 1.3;

&:hover,
&:focus {
color: var(--wp--preset--color--primary-500);
}
}
}

hr {
border-top: 10px;
margin: 0;
}

.wp-block-post-excerpt {
color: var(--wp--preset--color--grey-500);
margin-top: 0;
padding: 0 0 1.25rem 0;
}

.wp-block-read-more {
color: var(--wp--preset--color--primary-500);
font-size: var(--wp--preset--font-size--xxs);
font-weight: 300;
margin-bottom: 0.75rem;
margin-top: 0.75rem;
text-decoration: underline;

&:hover,
&:focus {
color: var(--wp--preset--color--primary-300);
}
}
}
}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"sort-packages": true
},
"require": {
"composer/installers": "^2.2.0"
"composer/installers": "^2.3.0"
},
"require-dev": {
"php": ">=8.0",
"php": ">=8.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"phpcompatibility/phpcompatibility-wp": "^2.1.4",
"phpcompatibility/phpcompatibility-wp": "^2.1.5",
"squizlabs/php_codesniffer": "^3.10.1",
"wp-cli/wp-cli-bundle": "^2.10.0",
"wp-coding-standards/wpcs": "^3.1.0"
Expand Down
Loading