diff --git a/package.json b/package.json index a1236ca00..2928709cb 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,7 @@ "@hello-pangea/dnd": "^16.2.0", "@juggle/resize-observer": "^3.3.1", "@lezer/highlight": "^1.0.0", - "@raspberrypifoundation/design-system-core": "^1.6.0", - "@raspberrypifoundation/design-system-react": "^1.6.0", + "@raspberrypifoundation/design-system-react": "2.6.2", "@react-three/drei": "9.114.3", "@react-three/fiber": "^8.0.13", "@reduxjs/toolkit": "^1.6.2", diff --git a/src/assets/stylesheets/App.scss b/src/assets/stylesheets/App.scss index 914b45073..31a54f481 100644 --- a/src/assets/stylesheets/App.scss +++ b/src/assets/stylesheets/App.scss @@ -1,7 +1,7 @@ -@use './rpf_design_system/font-size' as *; -@use './rpf_design_system/colours' as *; +@use "./rpf_design_system/font-size" as *; +@use "./rpf_design_system/colours" as *; -@use './Tabs' as *; +@use "./Tabs" as *; a { border: 3px solid transparent; @@ -12,17 +12,9 @@ a { } } -button { - all: initial; - border: 3px solid transparent; - cursor: pointer; - - @extend a; -} - input { - font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; } @@ -32,7 +24,6 @@ input { caret-color: $rpf-black; color-scheme: light; - .pythonrunner-input { color: rgb(36, 103, 236); } @@ -60,8 +51,8 @@ input { #app { display: flex; flex-flow: column; - font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @include font-size-1(regular); } diff --git a/src/assets/stylesheets/Button.scss b/src/assets/stylesheets/Button.scss deleted file mode 100644 index 541ec8fb0..000000000 --- a/src/assets/stylesheets/Button.scss +++ /dev/null @@ -1,265 +0,0 @@ -@use "./rpf_design_system/spacing" as *; -@use "./rpf_design_system/font-weight" as *; -@use "./rpf_design_system/colours" as *; - -.btn { - align-items: center; - border-radius: $space-0-5; - border: 3px solid transparent; - box-sizing: border-box; - color: inherit; - cursor: pointer; - display: inline-flex; - font-family: sans-serif; - font-size: inherit; - font-weight: $font-weight-bold; - gap: $space-0-5; - justify-content: center; - min-block-size: 44px; - min-inline-size: 44px; - padding: 10px; - position: relative; - text-align: center; - text-decoration: none; - - &:disabled { - background-color: $rpf-grey-600; - color: $rpf-white; - cursor: default; - } - - &:focus-visible { - border: 3px solid $rpf-brand-raspberry; - outline: none; - } - - &--primary { - background-color: var(--rpf-button-primary-background-color); - border-radius: $space-0-5; - - color: var(--rpf-button-primary-text-color); - - svg { - fill: var(--rpf-button-primary-text-color); - } - - &:active, - .btn-outer:active & { - background-color: var(--rpf-button-primary-background-color-active); - } - - &:focus-visible, - .btn-outer:focus-visible & { - background-color: var(--rpf-button-primary-background-color-focus); - } - - &:hover, - .btn-outer:hover & { - background-color: var(--rpf-button-primary-background-color-hover); - border-radius: $space-0-5; - } - - &:disabled { - background-color: var(--rpf-button-primary-background-color-disabled); - color: var(--rpf-button-primary-color-disabled); - - svg { - fill: var(--rpf-button-primary-color-disabled); - } - - &:hover, - .btn-outer:hover & { - background-color: var(--rpf-button-primary-background-color-disabled); - } - } - } - - &--secondary { - background-color: inherit; - - color: var(--rpf-button-secondary-text-color); - - svg { - fill: var(--rpf-button-secondary-text-color); - } - - &:active, - .btn-outer:active & { - background-color: inherit; - } - - &:focus-visible, - .btn-outer:focus-visible & { - background-color: inherit; - } - - &:hover, - .btn-outer:hover & { - background-color: inherit; - } - - &:disabled { - background-color: var(--rpf-button-secondary-background-color-disabled); - color: var(--rpf-button-secondary-background-color-active); - - svg { - fill: var(--rpf-button-secondary-background-color-active); - } - - &:hover, - .btn-outer:hover & { - background-color: var(--rpf-button-secondary-background-color-disabled); - } - } - - border: 2px solid var(--rpf-button-primary-background-color); - - &:active { - border: 2px solid var(--rpf-button-secondary-background-color-active); - } - - &:hover { - background-color: var(--rpf-button-secondary-background-color-hover); - color: var(--rpf-button-secondary-text-color-hover); - border-color: var(--rpf-button-secondary-border-color-hover) !important; - - svg { - fill: var(--rpf-button-secondary-text-color-hover); - } - } - - &:focus-visible { - outline: 3px solid var(--rpf-button-secondary-background-color-focus); - } - } - - &--tertiary { - background-color: inherit; - - color: inherit; - - &:active, - .btn-outer:active & { - background-color: inherit; - } - - &:focus-visible, - .btn-outer:focus-visible & { - background-color: inherit; - } - - &:hover, - .btn-outer:hover & { - background-color: inherit; - } - - &:disabled { - background-color: inherit; - color: $rpf-grey-600; - - svg { - fill: $rpf-grey-600; - } - - &:hover, - .btn-outer:hover & { - background-color: inherit; - } - } - - &:active { - color: $rpf-teal-900; - - svg { - fill: $rpf-teal-900; - } - } - - &:hover { - color: var(--rpf-button-tertiary-text-color-hover); - - svg { - fill: var(--rpf-button-tertiary-text-color-hover); - } - } - } - - &--danger { - background-color: $rpf-alert-error; - - color: $rpf-white; - - svg { - fill: $rpf-white; - } - - &:active, - .btn-outer:active & { - background-color: $rpf-alert-error; - } - - &:focus-visible, - .btn-outer:focus-visible & { - background-color: $rpf-alert-error; - } - - &:hover, - .btn-outer:hover & { - background-color: $rpf-alerts-error-tint; - } - - &:disabled { - background-color: $rpf-alert-error; - color: $rpf-white; - - svg { - fill: $rpf-white; - } - - &:hover, - .btn-outer:hover & { - background-color: $rpf-alert-error; - } - } - - &:focus-visible { - background-clip: padding-box; - border: 2px solid transparent; - outline: 3px solid $rpf-brand-raspberry; - } - } - - &--small { - min-block-size: unset; - min-inline-size: unset; - padding: $space-0-25; - } - - &--svg-only { - svg { - margin: 0; - } - } -} - -.btn-outer { - background: transparent; - border-radius: $space-0-5; - cursor: pointer; - padding: $space-0-5 0; - display: flex; - align-items: center; - justify-content: center; - - &:focus-visible { - outline: none; - - .btn { - border: 3px solid $rpf-brand-raspberry; - } - } - - &:has(.btn:disabled) { - cursor: default; - } -} diff --git a/src/assets/stylesheets/DesignSystemButton.scss b/src/assets/stylesheets/DesignSystemButton.scss deleted file mode 100644 index c66fe1f08..000000000 --- a/src/assets/stylesheets/DesignSystemButton.scss +++ /dev/null @@ -1,188 +0,0 @@ -@use "./rpf_design_system/colours" as *; - -.rpf-button--primary * { - svg { - fill: var(--rpf-button-primary-text-color); - } -} - -.rpf-button--tertiary * { - svg { - fill: var(--rpf-button-secondary-text-color) !important; - } -} - -.rpf-button { - flex-direction: row-reverse; -} - -.rpf-button--fit { - inline-size: fit-content; -} - -.rpf-button.rpf-button--fill { - justify-content: center; - inline-size: 100%; - box-sizing: border-box; -} - -.rpf-button--secondary { - justify-content: center; - align-items: center; -} - -.rpf-button--secondary * { - svg { - fill: $rpf-text-secondary; - } -} - -.--dark * { - .rpf-button--secondary { - border-color: $rpf-teal-400; - - span { - color: $rpf-white; - } - - svg { - fill: $rpf-white; - } - - &::before { - background-color: rgba($rpf-grey-700, 1); - } - - &:hover { - &::before { - background-color: rgba($rpf-white, 0.1); - } - - border-color: $rpf-teal-400; - } - - &:active { - &::before { - background-color: rgba($rpf-white, 0.15); - } - } - - &:disabled { - &::before { - background-color: inherit; - } - - span { - color: $rpf-grey-150; - } - - border-color: $rpf-grey-150; - background-color: inherit; - } - } - - .rpf-button--tertiary { - color: $rpf-white; - border: none; - - &:hover { - &::before { - background-color: rgba($rpf-white, 0.1); - } - } - - &:active { - &::before { - background-color: rgba($rpf-white, 0.15); - } - } - - &:disabled { - &::before { - background-color: inherit; - } - - span { - color: $rpf-grey-150; - } - - background-color: inherit; - } - } -} - -.--light * { - .rpf-button--secondary { - span { - color: $rpf-text-primary; - } - - &::before { - background-color: rgba($rpf-white, 1); - } - - &:hover { - &::before { - background-color: rgba(231, 248, 247, 1); - } - - border-color: $rpf-teal-400; - } - - &:active { - &::before { - background-color: rgba(220, 245, 243, 1); - } - } - - &:disabled { - &::before { - background-color: inherit; - } - - span { - color: rgba(213, 215, 220, 1); - } - - border-color: rgba(213, 215, 220, 1); - background-color: inherit; - } - } - - .rpf-button--tertiary { - color: $rpf-text-primary; - border: none; - - &::before { - background-color: rgba($rpf-white, 1); - } - - &:hover { - &::before { - background-color: rgba(231, 248, 247, 1); - } - } - - &:active { - &::before { - background-color: rgba(220, 245, 243, 1); - } - } - - &:disabled { - &::before { - background-color: inherit; - } - - span { - color: rgba(213, 215, 220, 1); - } - - background-color: inherit; - } - } -} - -.rpf-button__icon { - display: flex; -} diff --git a/src/assets/stylesheets/ExternalStyles.scss b/src/assets/stylesheets/ExternalStyles.scss index 923ebe18d..d41a856af 100644 --- a/src/assets/stylesheets/ExternalStyles.scss +++ b/src/assets/stylesheets/ExternalStyles.scss @@ -2,6 +2,6 @@ @use "../../../node_modules/react-toggle/style.css"; @use "../../../node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"; @use "../../../node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css"; -@use "../../../node_modules/@raspberrypifoundation/design-system-core/scss/components/alert.scss"; @use "../../../node_modules/material-symbols/sharp.scss"; @use "../../../node_modules/plotly.js/src/css/style.scss" as plotlyStyle; +@forward "@raspberrypifoundation/design-system-react/scss/design-system-core"; diff --git a/src/assets/stylesheets/InternalStyles.scss b/src/assets/stylesheets/InternalStyles.scss index 42167d9b3..7829a28aa 100644 --- a/src/assets/stylesheets/InternalStyles.scss +++ b/src/assets/stylesheets/InternalStyles.scss @@ -36,8 +36,6 @@ @use "./AstroPiModel" as *; @use "./MobileProjectBar" as *; @use "./ProjectBar" as *; -@use "./Button" as *; -@use "./DesignSystemButton" as *; @use "./SaveStatus" as *; @use "./ContextMenu" as *; @use "./FilePanel" as *; // needs to be below Button @@ -87,11 +85,6 @@ code { monospace; } -button { - all: initial; - font-size: inherit; -} - svg { min-inline-size: fit-content; } diff --git a/src/assets/stylesheets/ProjectBar.scss b/src/assets/stylesheets/ProjectBar.scss index 6041e50cb..06bf157f3 100644 --- a/src/assets/stylesheets/ProjectBar.scss +++ b/src/assets/stylesheets/ProjectBar.scss @@ -28,18 +28,9 @@ } } - .btn--save { - border-radius: $space-0-5; - @container (min-width: 560px) { - .icon { - display: none; - } - } - } - .project-bar__btn-wrapper { display: flex; - block-size: 100%; + block-size: 100%; } .project-bar__btn-wrapper:not(:last-child) { @@ -70,26 +61,3 @@ } } } - -.project-bar__btn { - border-radius: $space-0-5; - justify-content: center; - - margin: $space-0-5; - gap: $space-0-5; - - .text { - display: none; - } - - &:hover & { - border-radius: inherit; - } - - @container (min-width: 560px) { - .text { - min-inline-size: auto; - display: block; - } - } -} diff --git a/src/assets/stylesheets/ProjectInfo.scss b/src/assets/stylesheets/ProjectInfo.scss index 3406b9cbf..cc649d537 100644 --- a/src/assets/stylesheets/ProjectInfo.scss +++ b/src/assets/stylesheets/ProjectInfo.scss @@ -11,10 +11,6 @@ border-radius: $space-0-5; border: none; background-color: inherit; - - .btn--primary { - margin: 0 $space-0-5; - } } .project-type__label { diff --git a/src/assets/stylesheets/ProjectName.scss b/src/assets/stylesheets/ProjectName.scss index a8873be56..f14f4e15f 100644 --- a/src/assets/stylesheets/ProjectName.scss +++ b/src/assets/stylesheets/ProjectName.scss @@ -8,10 +8,6 @@ display: flex; block-size: 100%; padding-inline-start: $space-0-5; - - .btn--primary { - margin: 0 $space-0-5; - } } .project-name__title { diff --git a/src/assets/stylesheets/Sidebar.scss b/src/assets/stylesheets/Sidebar.scss index d853f49b9..447884b68 100644 --- a/src/assets/stylesheets/Sidebar.scss +++ b/src/assets/stylesheets/Sidebar.scss @@ -71,6 +71,11 @@ box-sizing: border-box; margin: 0; border: 2px solid transparent; + inline-size: $space-3; + block-size: $space-3; + border-radius: $space-0-5; + background-color: transparent; + cursor: pointer; svg { margin: 0; diff --git a/src/components/DesignSystemButton/DesignSystemButton.jsx b/src/components/DesignSystemButton/DesignSystemButton.jsx deleted file mode 100644 index 2050f0ded..000000000 --- a/src/components/DesignSystemButton/DesignSystemButton.jsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; -import { Button } from "@raspberrypifoundation/design-system-react"; -import classNames from "classnames"; -import "../../assets/stylesheets/DesignSystemButton.scss"; - -const DesignSystemButton = ({ className, fill = false, ...props }) => ( - ) : (
-
))} diff --git a/src/components/Menus/Sidebar/SidebarBarOption.jsx b/src/components/Menus/Sidebar/SidebarBarOption.jsx index ca303adb6..0324230d8 100644 --- a/src/components/Menus/Sidebar/SidebarBarOption.jsx +++ b/src/components/Menus/Sidebar/SidebarBarOption.jsx @@ -1,5 +1,4 @@ import React from "react"; -import Button from "../../Button/Button"; import classNames from "classnames"; const SidebarBarOption = (props) => { @@ -18,14 +17,15 @@ const SidebarBarOption = (props) => { "sidebar__bar-option-wrapper--selected": isActive, })} > - ); }; diff --git a/src/components/Modals/ErrorModal.jsx b/src/components/Modals/ErrorModal.jsx index 9a3918b97..65eda6e22 100644 --- a/src/components/Modals/ErrorModal.jsx +++ b/src/components/Modals/ErrorModal.jsx @@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux"; import { useTranslation } from "react-i18next"; import PropTypes from "prop-types"; -import Button from "../Button/Button"; +import { Button } from "@raspberrypifoundation/design-system-react"; import { closeErrorModal, setError } from "../../redux/EditorSlice"; import "../../assets/stylesheets/Modal.scss"; @@ -57,9 +57,9 @@ const ErrorModal = ({ errorType, additionalOnClose }) => {
diff --git a/src/components/Modals/GeneralModal.jsx b/src/components/Modals/GeneralModal.jsx index 6bd91efd6..8138b2d41 100644 --- a/src/components/Modals/GeneralModal.jsx +++ b/src/components/Modals/GeneralModal.jsx @@ -1,10 +1,9 @@ import React from "react"; import Modal from "react-modal"; -import Button from "../Button/Button"; +import { Button } from "@raspberrypifoundation/design-system-react"; import "../../assets/stylesheets/Modal.scss"; import { useTranslation } from "react-i18next"; -import CloseIcon from "../../utils/CloseIcon"; const GeneralModal = ({ buttons = [], @@ -47,10 +46,10 @@ const GeneralModal = ({

{heading}

{withCloseButton ? (