Skip to content

Commit 2d2e39b

Browse files
jamiebensteadabcampo-iryDNR500cocomarineadrian-rpf
authored
1415 show scratch logo in sidebar for scratch projects (#1492)
Work for RaspberryPiFoundation/digital-editor-issues#1415 Screenshot: <img width="363" height="302" alt="image" src="https://github.com/user-attachments/assets/b9f5eeda-5109-4a0a-b100-fdab4ba84e0a" /> --------- Co-authored-by: acampo <261805581+abcampo-iry@users.noreply.github.com> Co-authored-by: Nathan Richards <DNR500@users.noreply.github.com> Co-authored-by: HJ <cocomarine@users.noreply.github.com> Co-authored-by: Adrian Lansdown <adrian.lansdown@raspberrypi.org> Co-authored-by: Matthew Trew <9936426+mwtrew@users.noreply.github.com>
1 parent f170866 commit 2d2e39b

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/assets/scratch_icon.svg

Lines changed: 5 additions & 0 deletions
Loading

src/components/Menus/Sidebar/SidebarBar.jsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Button from "../../Button/Button";
1010
import SidebarBarOption from "./SidebarBarOption";
1111
import htmlLogo from "../../../assets/html_icon.svg";
1212
import pythonLogo from "../../../assets/python_icon.svg";
13+
import scratchLogo from "../../../assets/scratch_icon.svg";
1314
import { MOBILE_MEDIA_QUERY } from "../../../utils/mediaQueryBreakpoints";
1415

1516
const SidebarBar = (props) => {
@@ -64,6 +65,19 @@ const SidebarBar = (props) => {
6465
}
6566
};
6667

68+
const getProjectTypeLogo = (projectType) => {
69+
switch (projectType) {
70+
case "python":
71+
return pythonLogo;
72+
case "code_editor_scratch":
73+
return scratchLogo;
74+
case "html":
75+
return htmlLogo;
76+
default:
77+
return null;
78+
}
79+
};
80+
6781
return (
6882
<div
6983
className={classNames("sidebar__bar", {
@@ -73,7 +87,7 @@ const SidebarBar = (props) => {
7387
<div className={`sidebar__bar-options--top`}>
7488
<img
7589
className="editor-logo"
76-
src={project.project_type === "python" ? pythonLogo : htmlLogo}
90+
src={getProjectTypeLogo(project.project_type)}
7791
alt={t("header.editorLogoAltText")}
7892
/>
7993
{topMenuOptions.map((menuOption, i) => (

0 commit comments

Comments
 (0)