Skip to content

Commit 6021b9f

Browse files
create-issue-branch[bot]magdalenajadachMagdalena JadachScottsra405
authored
My projects page update (#447)
closes #442 --------- Co-authored-by: magdalenajadach <[email protected]> Co-authored-by: Magdalena Jadach <[email protected]> Co-authored-by: Scott <[email protected]> Co-authored-by: Scott Adams <[email protected]>
1 parent e402700 commit 6021b9f

File tree

25 files changed

+897
-621
lines changed

25 files changed

+897
-621
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1717

1818
- Refactored `NewComponentButton` (#450)
1919
- Modal styling (#450)
20+
- Projects tab layout (#447)
2021

2122
### Fixed
2223

src/Icons.js

Lines changed: 432 additions & 188 deletions
Large diffs are not rendered by default.

src/assets/python_icon.svg

Lines changed: 4 additions & 0 deletions
Loading

src/colours.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ $rpf-text-black: #212121;
6464
$rpf-white: #FFFFFF;
6565
$rpf-white-opacity8: #FFFFFF14;
6666

67+
$rpf-text-secondary: #4D575B;
68+
$rpf-darkmode-text-secondary: #CCCCCC;
69+
6770
:root,
6871
:host {
6972
--rpf-white: #{$rpf-white};

src/components/BetaBanner/BetaBanner.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
border-radius: 8px;
2020
background-color: $rpf-teal-tint-75;
2121
font-weight: var(--font-weight-bold);
22-
margin-right: var(--spacing-2)
22+
margin-right: var(--spacing-2);
2323
}
2424
}
2525

src/components/Button/Button.js

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
import './Button.scss';
1+
import "./Button.scss";
22

3-
import React from 'react';
4-
import { confirmAlert } from 'react-confirm-alert';
5-
import 'react-confirm-alert/src/react-confirm-alert.css';
3+
import React from "react";
4+
import { confirmAlert } from "react-confirm-alert";
5+
import "react-confirm-alert/src/react-confirm-alert.css";
66

77
const Button = (props) => {
8-
const { className, onClickHandler, ButtonIcon, buttonImage, buttonImageAltText, buttonText, buttonOuter, buttonOuterClassName, disabled, confirmText, title, label } = props;
9-
10-
const buttonClass = `btn${className ? ` ${className}` : ""}${buttonText ? "" : " btn--svg-only"}`
8+
const {
9+
className,
10+
onClickHandler,
11+
ButtonIcon,
12+
buttonImage,
13+
buttonImageAltText,
14+
buttonText,
15+
buttonOuter,
16+
buttonOuterClassName,
17+
disabled,
18+
confirmText,
19+
title,
20+
label,
21+
buttonIconPosition = "left",
22+
} = props;
23+
24+
const buttonClass = `btn${className ? ` ${className}` : ""}${
25+
buttonText ? "" : " btn--svg-only"
26+
}`;
1127

1228
const onButtonClick = (e) => {
1329
if (!confirmText) {
@@ -19,34 +35,45 @@ const Button = (props) => {
1935
message: confirmText,
2036
buttons: [
2137
{
22-
label: 'Yes',
23-
onClick: () => onClickHandler(e)
38+
label: "Yes",
39+
onClick: () => onClickHandler(e),
2440
},
2541
{
26-
label: 'No',
27-
}
28-
]
42+
label: "No",
43+
},
44+
],
2945
});
30-
}
46+
};
3147

3248
const button = (
33-
<button className={buttonClass} disabled={disabled} aria-label={label} title={title} onClick={buttonOuter ? null : onButtonClick}>
34-
{ buttonImage ? <img src={buttonImage} alt={buttonImageAltText}/> : null }
35-
{ ButtonIcon ? <ButtonIcon /> : null }
36-
{ buttonText ? <span>{buttonText}</span> : null }
49+
<button
50+
className={buttonClass}
51+
disabled={disabled}
52+
aria-label={label}
53+
title={title}
54+
onClick={buttonOuter ? null : onButtonClick}
55+
>
56+
{buttonImage ? <img src={buttonImage} alt={buttonImageAltText} /> : null}
57+
{ButtonIcon && buttonIconPosition === "left" ? <ButtonIcon /> : null}
58+
{buttonText ? <span>{buttonText}</span> : null}
59+
{ButtonIcon && buttonIconPosition === "right" ? <ButtonIcon /> : null}
3760
</button>
3861
);
3962

4063
if (buttonOuter) {
4164
return (
42-
<div className={`btn-outer${buttonOuterClassName ? ` ${buttonOuterClassName}` : ''}`} onClick={onButtonClick}>
65+
<div
66+
className={`btn-outer${
67+
buttonOuterClassName ? ` ${buttonOuterClassName}` : ""
68+
}`}
69+
onClick={onButtonClick}
70+
>
4371
{button}
4472
</div>
45-
)
73+
);
4674
}
4775

4876
return button;
4977
};
5078

5179
export default Button;
52-

src/components/Button/Button.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
font-family: sans-serif;
5353
font-size: inherit;
5454
font-weight: var(--font-weight-bold);
55+
gap: var(--spacing-1);
5556
justify-content: center;
5657
margin: 6px;
5758
min-height: 44px;
@@ -73,10 +74,6 @@
7374
outline: none;
7475
}
7576

76-
svg {
77-
margin-right: var(--spacing-1);
78-
}
79-
8077
&--small {
8178
padding: var(--spacing-four);
8279
}

src/components/Editor/Project/Project.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353

5454
.proj-runner-container {
5555
display: flex;
56-
flex: 5;
56+
flex-flow: column;
57+
flex: 5 1;
5758
overflow-y: hidden;
5859

5960
.react-tabs__tab-panel--selected {

src/components/Editor/Runners/HtmlRunner/HtmlRunner.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,48 @@
11
/* eslint-disable react-hooks/exhaustive-deps */
2-
import './HtmlRunner.css';
3-
import React, { useRef, useEffect } from 'react';
4-
import { useSelector } from 'react-redux'
2+
import "./HtmlRunner.scss";
3+
import React, { useRef, useEffect } from "react";
4+
import { useSelector } from "react-redux";
55

66
function HtmlRunner() {
77
const projectCode = useSelector((state) => state.editor.project.components);
88
const output = useRef();
99

1010
const getBlobURL = (code, type) => {
11-
const blob = new Blob([code], { type })
12-
return URL.createObjectURL(blob)
13-
}
11+
const blob = new Blob([code], { type });
12+
return URL.createObjectURL(blob);
13+
};
1414

1515
useEffect(() => {
1616
runCode();
1717
}, [projectCode]);
1818

1919
const runCode = () => {
2020
// TODO: get html files and handle urls for non index pages
21-
var indexPage = projectCode[0].content;
22-
23-
var cssFiles = projectCode.filter(component => component.extension === 'css');
24-
cssFiles.forEach(cssFile => {
25-
var cssFileBlob = getBlobURL(cssFile.content, 'text/css');
26-
indexPage = indexPage.replace(`href="${cssFile.name}.css"`, `href="${cssFileBlob}"`)
21+
let indexPage = projectCode[0].content;
22+
23+
const cssFiles = projectCode.filter(
24+
(component) => component.extension === "css"
25+
);
26+
cssFiles.forEach((cssFile) => {
27+
const cssFileBlob = getBlobURL(cssFile.content, "text/css");
28+
indexPage = indexPage.replace(
29+
`href="${cssFile.name}.css"`,
30+
`href="${cssFileBlob}"`
31+
);
2732
});
2833

29-
var blob = getBlobURL(indexPage, 'text/html');
34+
const blob = getBlobURL(indexPage, "text/html");
3035
output.current.src = blob;
31-
}
36+
};
3237

3338
return (
3439
<div className="htmlrunner-container">
35-
<iframe className="htmlrunner-iframe" id="output-frame" title="html-output-frame" ref={output} />
40+
<iframe
41+
className="htmlrunner-iframe"
42+
id="output-frame"
43+
title="html-output-frame"
44+
ref={output}
45+
/>
3646
</div>
3747
);
3848
}

0 commit comments

Comments
 (0)