Skip to content

Release/WDSBT v1.0 #32

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

Merged
merged 36 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 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
728674d
WDSBT-23 - Update packages and README
khleomix Aug 21, 2024
b0e0f54
WDSBT-23 - Update ignored files
khleomix Aug 21, 2024
5fead76
WDSBT-23 - Minor text update and fix to webpack paths
khleomix Aug 21, 2024
e61b602
WDSBT-23 - Update composer files
khleomix Aug 21, 2024
b7b7b0a
WDSBT-23 - Update templates for single and archive
khleomix Aug 22, 2024
39444d7
WDSBT-23 - Show related content across same categories
khleomix Aug 22, 2024
4c9c3c2
Add back to top branch files to release
khleomix Aug 22, 2024
02c13a3
Add back missing styles for button size variation
khleomix Aug 22, 2024
f64fca5
Add back missing styles for button size variation
khleomix Aug 22, 2024
5aa2c7d
WDSBT-23 - Clean up posts blocks
khleomix Aug 23, 2024
ba658ca
WDSBT-23 - Update npm packages
khleomix Aug 23, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ vendor/
# theme
build/
/blocks/
!assets/blocks/

#tests
pa11y-ci-report/
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
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
blocks/
/blocks/
!assets/blocks/
build/
node_modules/
vendor/
Expand Down
3 changes: 2 additions & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build/
/blocks/
!assets/blocks/
/build/
vendor/
node_modules/
!.*.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Meet WDS BT, a stylish block theme, tailored for WordPress, featuring native blo
│   │   ├── tag-cloud.scss
│   │   ├── verse.scss
│   │   └── video.scss
│   ├── template-parts
│   ├── template-parts
│   │   ├── _index.scss
│   │   ├── footer.scss
│   │   └── header.scss
Expand Down Expand Up @@ -299,7 +299,7 @@ This will process JavaScript, SCSS, optimize images, and generate necessary file
<details closed>
<summary><b>Overriding/Customizing Block Styles</b></summary>

1. Navigate to the `assets/scss/blocks/` directory within your theme. If overriding a core block style, use the `core` folder, if overriding a block from a plugin use the `custom` folder.
1. Navigate to the `assets/scss/blocks/` directory within your theme. If overriding a core block style, use the `core` folder, if overriding a block from a plugin use the `third-party` folder.

2. Create an SCSS file with the exact filename as the block name you want to customize. This file will house your custom styles for that specific block.

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';
34 changes: 22 additions & 12 deletions assets/scss/blocks/core/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,41 @@
}
}

&.large {
&.has-size-m {
.wp-block-button__link {
border-radius: 6px;
border-width: 2px;
font-size: 1rem;
}
font-size: var(--wp--preset--font-size--s);
padding: 0.625rem 2.5rem 0.625rem 1.25rem;

&::after {
height: 1.25rem;
width: 1.25rem;
&::after {
height: 1.25rem;
width: 1.25rem;
}
}
}

&.xlarge {
&.has-size-l {
.wp-block-button__link {
border-radius: 6px;
border-width: 2px;
font-size: var(--wp--preset--font-size--s);
font-size: var(--wp--preset--font-size--m);
padding: 0.9375rem 3rem 0.9375rem 1.25rem;

&::after {
height: 1.5rem;
width: 1.5rem;
}
}
}

&.has-size-xl {
.wp-block-button__link {
font-size: var(--wp--preset--font-size--l);
padding: 0.9375rem 3rem 0.9375rem 1.25rem;

&::after {
height: 1.75rem;
width: 1.75rem;
}
}
}
}

@include responsive-max(600px) {
Expand Down
Loading