-
Notifications
You must be signed in to change notification settings - Fork 11
fix: button debt #1262
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
base: main
Are you sure you want to change the base?
fix: button debt #1262
Conversation
- 2.0.0 uses vite and packages core, so that dep can removed. - Link to core style does however need to be added to the app, following the update guide for the design system. - TextEncoder/TextDecoder was not set up in jest and this was causing some design system component to fail tests.
- No buttons using href prop so no changes needed
Closes RaspberryPiFoundation/digital-editor-issues#968 ## Summary Update to the latest design system to take advantage of new components and features. ## What's been done? - Incrementally updated - see commits - Ran all tests at each commit - Followed design system [updating guide for v2+](https://github.com/RaspberryPiFoundation/design-system-react/blob/main/UPDATING.md) - Fixed any breaking changes - only 1 (see commits details) - Added material icon font to host (web component preview page) since the design system depends on this for some components. ## Screenshots <img width="1422" height="965" alt="Screenshot 2025-10-29 at 09 33 16" src="https://github.com/user-attachments/assets/919b6bb0-ba72-49ef-a260-48605227755d" /> <img width="501" height="754" alt="Screenshot 2025-10-29 at 09 33 26" src="https://github.com/user-attachments/assets/52310fec-2c66-4602-9301-182c3a114f88" /> <img width="1200" height="889" alt="Screenshot 2025-10-29 at 09 33 53" src="https://github.com/user-attachments/assets/bc3c294c-f830-4dcc-98ce-764165f473c5" /> ## Issues to be solved in another PR - Some styles appear to be broken/missing - **Note this is only when "use_editor_styles" isn't true** - This is an existing [issue](#1195). - There are also some issues with Design System components not looking correct. This is because editor-ui is overriding design-system-core styles via classes or global selectors (e.g. `button`) rather than overriding custom properties - which would normally avoid most breaking changes. Largely "core breaking component changes" only affect upstream packages (react/rails). **Suggested tasks:** - [ ] Ensure all editor CSS custom properties have a fallback, so that a theme isn't required ([Issue](#1195)) - [ ] Migrate to using design system buttons - [See PR](#1262). - [ ] Migrate to theming using Design System component via the CSS custom properties <img width="1263" height="923" alt="Screenshot 2025-10-29 at 09 39 38" src="https://github.com/user-attachments/assets/39c88da0-fad4-4648-8431-22a09366211a" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the design system packages from version 1.6.0 to 2.6.2, replacing the old custom Button components with the new standardized Button component from @raspberrypifoundation/design-system-react. The upgrade includes API changes, removes deprecated wrapper components, and adds necessary polyfills for the test environment.
- Upgraded
@raspberrypifoundation/design-system-reactfrom ^1.6.0 to 2.6.2 - Replaced all custom Button and DesignSystemButton components with the design system Button component
- Updated button prop names to align with the new API (e.g.,
onClickHandler→onClick,buttonText→text)
Reviewed Changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json, yarn.lock | Upgraded design system packages and updated dependencies |
| src/web-component.html | Added Material Symbols font stylesheet and fixed JavaScript syntax issues |
| src/utils/setupTests.js | Added TextEncoder/TextDecoder polyfills for Jest environment |
| src/utils/ToastCloseButton.jsx, src/utils/Notifications.js | Migrated to design system Button component |
| src/components/SaveButton/SaveButton.jsx | Updated to use design system Button with new prop names |
| src/components/RunButton/*.jsx | Replaced custom Button with design system Button |
| src/components/ProjectName/ProjectName.jsx | Updated icon names to use Material Symbols naming |
| src/components/ProjectBar/ProjectBar.jsx | Removed Icon prop and updated button props |
| src/components/Modals/*.jsx | Migrated all modal buttons to design system Button |
| src/components/Menus/Sidebar/**/*.jsx | Updated sidebar buttons and replaced custom buttons with native button elements |
| src/components/Editor/**/*.jsx | Updated editor buttons to use design system Button |
| src/components/DownloadButton/DownloadButton.jsx | Simplified props and migrated to design system Button |
| src/components/DesignSystemButton/DesignSystemButton.jsx | Removed deprecated wrapper component |
| src/assets/stylesheets/*.scss | Removed custom button styles and updated design system imports |
Comments suppressed due to low confidence (1)
src/components/RunButton/RunnerControls.jsx:1
- Commented-out code should be removed. If these properties need to be preserved for reference, document why in a comment or remove them entirely to keep the codebase clean.
import React from "react";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| onClickHandler={goToPreviousStep} | ||
| ButtonIcon={ChevronLeft} | ||
| onClick={goToPreviousStep} | ||
| icon="chevron_right" |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous step button uses 'chevron_right' icon but should use 'chevron_left' to indicate backward navigation. Both buttons currently have the same icon.
| icon="chevron_right" | |
| icon="chevron_left" |
| icon={<PlusIcon />} | ||
| <Button | ||
| icon="add" | ||
| linkComponent={null} |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linkComponent={null} prop appears unusual and may not be a documented prop for the Button component. If this is meant to prevent default link behavior, verify this prop is supported in version 2.6.2 of the design system, or remove it if unnecessary.
| linkComponent={null} |
| textAlways | ||
| small |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props textAlways and small don't follow the design system API conventions. Based on other usages in the codebase, small should likely be size=\"small\". The textAlways prop may not be supported in the new design system version and needs verification or removal.
| textAlways | ||
| small |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props textAlways and small don't follow the design system API conventions. Based on other usages in the codebase, small should likely be size=\"small\". The textAlways prop may not be supported in the new design system version and needs verification or removal.
| // buttonOuter={skinny} | ||
| // className={`btn--stop btn--primary${skinny ? " btn--small" : ""}`} |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code should be removed. If these properties need to be preserved for reference, document why in a comment or remove them entirely to keep the codebase clean.
Warning
WIP - Relys on #1261 for initial design system update
Still to be done:
Summary of Button changes
✨ Summary partially generated with Copilot but manually corrected and checked
A major refactoring effort focused on migrating from legacy custom buttons to Design System (DS) buttons throughout the codebase. Here are the key changes:
🔄 Button Migration & Refactoring (Major Theme)
The most significant change is the replacement of custom button components with standardised Design System buttons:
🗂️ File Structure Changes
InternalStyles.scssButton.scss,DesignSystemButton.scss)🎨 Styling Updates
📦 Dependencies & Build
@raspberrypifoundation/design-system-react🏗️ Component Architecture Improvements
buttonText/onClickHandlertotext/onClickfilltofullWidthfor consistency🧹 Code Quality
🎯 Key Benefits of This Refactoring
🔧 Technical Details
Key Prop Changes:
Import Changes:
This migration ensures the entire UI follows consistent design patterns while improving code maintainability and user experience.