Skip to content

Conversation

@maxelkins
Copy link
Contributor

@maxelkins maxelkins commented Oct 17, 2025

Warning

WIP - Relys on #1261 for initial design system update

Still to be done:

  • Still some failing tests to fix - mainly mobile styling related
  • Check all mobile styles
  • Check various states
    • AstroPi
    • HTML/CSS + Python
    • All sidebar panels
    • Projects site intergration
    • Logged in state
    • CEFE
  • Button in projectbar/Split view button
  • Fix project file dropdown - ideally migrate to floating-ui / css anchor-positioning
  • Document the requirement for material-symbols on host

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:

  • Sidebar components - Custom button styles updated since this does not used DS button.
  • NewFileModal - Uses DS Button
  • ErrorModal - Uses DS Button
  • NewComponentButton - Uses DS Button
  • ProjectName - Uses DS Button (edit/save functionality)
  • Notifications - Uses DS Button
  • StopButton - Uses DS Button
  • RunButton - Uses DS Button
  • SaveButton - Uses DS Button
  • RunnerControls - Uses DS Button
  • ToastCloseButton - Uses DS Button
  • ProgressBar - Uses DS Buttons (navigation)
  • GeneralModal - Uses DS Button
  • RenameFileModal - Uses DS Button
  • InstructionsPanel - Uses DS Button
  • NewInputPanelButton - Uses DS Button
  • ImageUploadButton - Uses DS Button
  • DownloadButton - Uses DS Button
  • EditorInput Tab Buttons - Uses DS Button

🗂️ File Structure Changes

  • Removed legacy button files from InternalStyles.scss
  • Legacy button styles completely removed (Button.scss, DesignSystemButton.scss)

🎨 Styling Updates

  • Sidebar styling fixes after legacy button removal
  • FilePanel styling improvements - Better layout with flexbox, improved hover states
  • Context menu styling cleanup
  • Tab styling updates (some commented out for future work)

📦 Dependencies & Build

  • Updated design system React from multiple versions (1.7.0 → 2.6.2)
  • Updated import statements throughout codebase to use @raspberrypifoundation/design-system-react
  • Web component preview improvements adding material symbols font support

🏗️ Component Architecture Improvements

  • Prop standardisation: Changed from buttonText/onClickHandler to text/onClick
  • Icon handling: Moved from custom icon components to standardised icon font props
    • Note this could be reverted in cases we rely on specific SVGs, however this does make it more tricky the theme and maintain.
  • Layout props: Changed fill to fullWidth for consistency

🧹 Code Quality

  • Consistent formatting and indentation fixes - using repo rules.
  • Removed unused imports and dependencies
  • Cleaner component interfaces with standardised props
  • Better accessibility with proper ARIA labels

🎯 Key Benefits of This Refactoring

  1. Consistency: All buttons now follow the same design system patterns
  2. Maintainability: Single source of truth for button styling
  3. Accessibility: Better/consistent ARIA support and keyboard navigation
  4. Performance: Reduced CSS bundle size by removing duplicate styles
  5. Developer Experience: Consistent API across all button interactions

🔧 Technical Details

Key Prop Changes:

// Old Pattern
<Button 
  buttonText="Save"
  onClickHandler={handleSave}
  ButtonIcon={SaveIcon}
  className="btn--primary"
/>

// New Pattern  
<Button
  text="Save"
  onClick={handleSave}
  icon="save"
  type="primary"
/>

Import Changes:

// Old
import Button from "../Button/Button";
import DesignSystemButton from "../DesignSystemButton/DesignSystemButton";

// New
import { Button } from "@raspberrypifoundation/design-system-react";

This migration ensures the entire UI follows consistent design patterns while improving code maintainability and user experience.

- 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
@maxelkins maxelkins changed the title Fix button debt fix: button debt Oct 17, 2025
maxelkins added a commit that referenced this pull request Oct 30, 2025
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"
/>
@adrian-rpf adrian-rpf requested a review from Copilot November 3, 2025 17:24
Copy link
Contributor

Copilot AI left a 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-react from ^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., onClickHandleronClick, buttonTexttext)

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"
Copy link

Copilot AI Nov 3, 2025

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.

Suggested change
icon="chevron_right"
icon="chevron_left"

Copilot uses AI. Check for mistakes.
icon={<PlusIcon />}
<Button
icon="add"
linkComponent={null}
Copy link

Copilot AI Nov 3, 2025

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.

Suggested change
linkComponent={null}

Copilot uses AI. Check for mistakes.
Comment on lines 140 to 141
textAlways
small
Copy link

Copilot AI Nov 3, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 155 to 156
textAlways
small
Copy link

Copilot AI Nov 3, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
// buttonOuter={skinny}
// className={`btn--stop btn--primary${skinny ? " btn--small" : ""}`}
Copy link

Copilot AI Nov 3, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants