Skip to content

Commit 45552ac

Browse files
authored
Projects site final step (#1402)
A few changes to enable us to inject a final step to the instructions panel from projects-ui: - Added `EditorFinalStep.scss` which has all the styling this new instruction step might need - Added primary button styling to `Instructions.scss` - Added `cc-wallpaper.svg` needed for one of the components being injected in the new final step - Increase the image size limit in webpack config (needed to do this for the svg mentioned in previous point) Questions/suggestions welcome :)
1 parent d856807 commit 45552ac

6 files changed

Lines changed: 110 additions & 6 deletions

File tree

src/assets/cc-wallpaper.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
@use "@raspberrypifoundation/design-system-core/scss/mixins/typography" as
2+
typography;
3+
@use "./rpf_design_system/spacing" as *;
4+
.project-instructions {
5+
.whats-next {
6+
display: flex;
7+
flex-direction: column;
8+
align-items: center;
9+
}
10+
.c-badge-achievement-card {
11+
p {
12+
margin: 0;
13+
}
14+
align-items: center;
15+
background-color: var(--cc-light-cyan);
16+
background-image: url("../cc-wallpaper.svg");
17+
background-position: center;
18+
background-size: cover;
19+
border-radius: $space-1-5;
20+
display: flex;
21+
flex-direction: column;
22+
gap: $space-1-5;
23+
overflow: hidden;
24+
padding-block: $space-2-5;
25+
padding-inline: $space-2;
26+
position: relative;
27+
28+
&::before {
29+
background: linear-gradient(
30+
90deg,
31+
transparent 0%,
32+
color-mix(in srgb, var(--cc-light-cyan) 90%, transparent) 20%,
33+
color-mix(in srgb, var(--cc-light-cyan) 100%, transparent) 50%,
34+
color-mix(in srgb, var(--cc-light-cyan) 90%, transparent) 80%,
35+
transparent 100%
36+
);
37+
border-radius: $space-1-5;
38+
content: "";
39+
inset: 0;
40+
pointer-events: none;
41+
position: absolute;
42+
z-index: 1;
43+
}
44+
45+
> * {
46+
position: relative;
47+
z-index: 2;
48+
}
49+
50+
img {
51+
inline-size: 100px;
52+
}
53+
54+
&__text-content {
55+
display: flex;
56+
flex-direction: column;
57+
gap: 10px;
58+
text-align: center;
59+
}
60+
61+
&__title {
62+
@include typography.style-2(bold);
63+
}
64+
}
65+
}

src/assets/stylesheets/Instructions.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,25 @@
122122
}
123123
}
124124

125+
.rpf-button {
126+
&--primary {
127+
background-color: var(--rpf-button-primary-background-color);
128+
color: var(--rpf-button-primary-text-color);
129+
border-radius: var(--project-bar-button-radius, 8px);
130+
&::before {
131+
background-color: var(--rpf-button-primary-background-color);
132+
border-color: var(--rpf-button-primary-background-color);
133+
border-radius: var(--project-bar-button-radius, 8px);
134+
}
135+
&:hover::before,
136+
&:active::before,
137+
&:focus-visible::before {
138+
background-color: var(--rpf-button-primary-background-color-hover);
139+
border-color: var(--rpf-button-primary-background-color-hover);
140+
}
141+
}
142+
}
143+
125144
.c-code-filename {
126145
font-family: var(--wc-font-family-monospace);
127146
margin: 0;

src/assets/stylesheets/InternalStyles.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@use "./ContextMenu" as *;
4141
@use "./FilePanel" as *; // needs to be below Button
4242
@use "./EmbeddedViewer" as *;
43+
@use "./EditorFinalStep.scss" as *;
4344

4445
@use "./settings/fonts" as fonts;
4546

@@ -51,8 +52,14 @@
5152
// Allow fonts to be overridden by the host application via
5253
// --editor-font-family-*, falling back to the default sets in
5354
// settings/fonts.scss
54-
--wc-font-family-sans-serif: var(--editor-font-family-sans-serif, #{fonts.$font-family-sans-serif});
55-
--wc-font-family-monospace: var(--editor-font-family-monospace, #{fonts.$font-family-monospace});
55+
--wc-font-family-sans-serif: var(
56+
--editor-font-family-sans-serif,
57+
#{fonts.$font-family-sans-serif}
58+
);
59+
--wc-font-family-monospace: var(
60+
--editor-font-family-monospace,
61+
#{fonts.$font-family-monospace}
62+
);
5663

5764
background: var(--editor-secondary-theme, transparent);
5865
font-family: var(--wc-font-family-sans-serif);

src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const InstructionsPanel = () => {
3636
});
3737
}
3838
}, []);
39+
3940
const [showModal, setShowModal] = useState(false);
4041
const instructionsEditable = useSelector(
4142
(state) => state.editor?.instructionsEditable,

webpack.config.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ if (!publicUrl.endsWith("/")) {
1313
const scratchStaticDir = path.resolve(
1414
__dirname,
1515
"node_modules/@scratch/scratch-gui/dist/static",
16-
)
16+
);
1717

1818
const scratchChunkDir = path.resolve(
1919
__dirname,
2020
"node_modules/@scratch/scratch-gui/dist/chunks",
21-
)
21+
);
2222

2323
module.exports = {
2424
entry: {
@@ -75,9 +75,20 @@ module.exports = {
7575
},
7676
],
7777
},
78+
{
79+
test: /cc-wallpaper\.svg$/,
80+
use: [
81+
{
82+
loader: "url-loader",
83+
options: {
84+
limit: 100000,
85+
},
86+
},
87+
],
88+
},
7889
{
7990
test: /\.svg$/,
80-
exclude: /\/src\/assets\/icons\/.*\.svg$/,
91+
exclude: [/\/src\/assets\/icons\/.*\.svg$/, /cc-wallpaper\.svg$/],
8192
use: [
8293
{
8394
loader: "url-loader",
@@ -133,7 +144,7 @@ module.exports = {
133144
{
134145
directory: scratchChunkDir,
135146
publicPath: `${publicUrl}scratch-gui/chunks`,
136-
}
147+
},
137148
],
138149
headers: {
139150
"Access-Control-Allow-Origin": "*",

0 commit comments

Comments
 (0)