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

New Block: Implement progress bar block #68652

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

Infinite-Null
Copy link
Contributor

Closes: #34219

What?

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

Before After

@Infinite-Null Infinite-Null changed the title Implement meter progress block with basic controls New Block: Implement progress block Jan 14, 2025
@Infinite-Null Infinite-Null changed the title New Block: Implement progress block New Block: Implement progress bar block Jan 14, 2025
@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. New Block Suggestion for a new block labels Jan 14, 2025
- Introduced default attributes for `backgroundColor`, `progressColor`, `height`, and `showValue`.
- Added a `height` attribute to control the height of the progress bar dynamically.
- Added a `showValue` toggle to display the progress percentage.
- Replaced `TextControl` with `RichText` for the `label` attribute, enabling inline editing.
- Adjusted styles for better flexibility and customization.
- Updated `edit.js` and `save.js` to handle new attributes and functionality.
- Refactored progress bar rendering logic for cleaner output.
- Replaced `PanelBody` with `ToolsPanel` and `ToolsPanelItem` for settings organization.
- Added `resetAll` functionality to `ToolsPanel` for resetting all attributes to default values.
- Integrated `useToolsPanelDropdownMenuProps` for dropdown menu support.
- Refactored individual settings (`value`, `max`, `height`, `showValue`) into `ToolsPanelItem` components with better attribute handling.
- Improved UI and UX for configuring the Progress Bar block in the editor.
- Updated the Progress Bar block to use a custom `progressBar` icon from the WordPress icons library instead of the `home` icon.
- Added the `progressBar` icon to the icons library for consistent usage.
- Adjusted the block metadata to reference the new icon, enhancing visual representation in the editor.
- Simplified inline styles for the Progress Bar block to improve maintainability:
  - Removed unnecessary `overflow`, `position`, and `transition` properties from `progressBarStyle` and `progressStyle`.
  - Updated structural styles for better compatibility and readability.
- Removed redundant inline `div` styles in the block's markup for a cleaner layout.
- Integrated a dedicated SCSS file (`progress-bar/style.scss`) for the Progress Bar block:
  - Ensures consistent styling across the block.
  - Facilitates easier future modifications by consolidating styles into a central location.
- Updated `style.scss` to include the newly created `progress-bar/style.scss` file.
- Registered the `Progress Bar` block in `lib/blocks.php` to ensure proper loading and functionality within the block editor.
- Refactored the save logic for the Progress Bar block:
  - Simplified `progressBarStyle` and `progressStyle` by removing redundant CSS properties (`overflow`, `position`, `height`, and `transition`).
  - Updated the block's markup to streamline structure and remove unnecessary `div` styles for better performance and maintainability.
- Ensured the output HTML remains lightweight and optimized for frontend rendering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Block Suggestion for a new block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Progress Bar block (or a core-blocks approach to building a progress-style block pattern)
2 participants