Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions public/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
"cookies": "Cookies",
"accessibility": "Accessibility",
"safeguarding": "Safeguarding",
"licenses": "Licenses",
"charity": "Raspberry Pi Foundation - UK registered charity 1129409",
"settingsMenu": {
"heading": "Settings",
Expand Down
19 changes: 12 additions & 7 deletions src/assets/stylesheets/InfoPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@
display: flex;
flex-direction: column;

a {
a, button {
@include font-size-1(regular);
font-family: inherit;
font-weight: $font-weight-bold;
text-decoration: underline;
}
}

.info-panel__link {
&:last-of-type {
margin-block-end: $space-1;
button {
border: 3px solid transparent;
}

p {
margin-block-start: $space-1;
}
}

Expand All @@ -36,7 +39,8 @@
background-color: $rpf-grey-600;
}

.info-panel__links a {
.info-panel__links a,
.info-panel__links button {
color: $rpf-text-primary-darkmode;
}
}
Expand All @@ -47,7 +51,8 @@
background-color: $rpf-grey-50;
}

.info-panel__links a {
.info-panel__links a,
.info-panel__links button {
color: $rpf-text-primary;
}
}
28 changes: 27 additions & 1 deletion src/components/Menus/Sidebar/InfoPanel/InfoPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from "react";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { Modal } from "@raspberrypifoundation/design-system-react";
import SidebarPanel from "../SidebarPanel";

import "../../../../assets/stylesheets/InfoPanel.scss";
Expand All @@ -24,6 +26,10 @@ const feedbackUrl = (url) => {

const InfoPanel = ({ feedbackFormUrl = CODE_EDITOR_FEEDBACK_URL }) => {
const { t } = useTranslation();
const [isLicensesModalOpen, setIsLicensesModalOpen] = useState(false);
const projectType = useSelector((state) => state.editor.project.project_type);
const isScratchProject = projectType === "code_editor_scratch";

const links = [
{
id: "help",
Expand Down Expand Up @@ -74,8 +80,28 @@ const InfoPanel = ({ feedbackFormUrl = CODE_EDITOR_FEEDBACK_URL }) => {
{link.text}
</a>
))}
{isScratchProject && (
<button
type="button"
className="info-panel__link"
onClick={() => setIsLicensesModalOpen(true)}
>
{t("sidebar.licenses")}
</button>
)}
<p>{t("sidebar.charity")}</p>
</div>

{isScratchProject && (
<Modal
isOpen={isLicensesModalOpen}
setIsOpen={setIsLicensesModalOpen}
heading={t("sidebar.licenses")}
showCloseButton
>
<p>Hello, this is a test modal content.</p>
</Modal>
)}
</SidebarPanel>
);
};
Expand Down
Loading