Skip to content

Commit b27fe61

Browse files
Refactor CanvasIllustration component: remove unused SVG paths, update node icons, and adjust styles for improved layout and responsiveness
Signed-off-by: 11yashiagrawal <11yashiagrawal@gmail.com>
1 parent d398335 commit b27fe61

5 files changed

Lines changed: 188 additions & 281 deletions

File tree

src/components/Learn-Components/Canvas-Illustration/canvas-illustration.style.js

Lines changed: 94 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import styled, { keyframes } from "styled-components";
22

3-
const flowAnimation = keyframes`
4-
to {
5-
stroke-dashoffset: -20;
6-
}
7-
`;
8-
93
const float1 = keyframes`
104
0% { transform: translate(0, 0); }
115
50% { transform: translate(10px, -15px); }
@@ -94,47 +88,6 @@ const CanvasIllustrationWrapper = styled.div`
9488
}
9589
}
9690
97-
/* SVG layer for connections */
98-
.canvas-svg {
99-
position: absolute;
100-
top: 0;
101-
left: 0;
102-
width: 100%;
103-
height: 100%;
104-
z-index: 1;
105-
pointer-events: none;
106-
107-
path {
108-
fill: none;
109-
stroke: #00b39f;
110-
stroke-width: 2.5;
111-
stroke-dasharray: 6 6;
112-
animation: ${flowAnimation} 1s linear infinite;
113-
}
114-
115-
path.muted {
116-
stroke-width: 1.8;
117-
stroke-dasharray: 3 8;
118-
opacity: 0.58;
119-
}
120-
121-
path.blue-path {
122-
stroke: #326ce5;
123-
}
124-
125-
path.purple-path {
126-
stroke: #7a4bb5;
127-
}
128-
129-
path.teal-path {
130-
stroke: #00b39f;
131-
}
132-
133-
path.yellow-path {
134-
stroke: #ebc017;
135-
}
136-
}
137-
13891
/* Canvas nodes */
13992
.canvas-node {
14093
position: absolute;
@@ -148,7 +101,7 @@ const CanvasIllustrationWrapper = styled.div`
148101
border: 2px solid ${(props) => props.theme.green00D3A9ToGreyE6E6E6};
149102
border-radius: 8px;
150103
color: ${(props) => props.theme.whiteToBlack};
151-
font-size: 1rem;
104+
font-size: 1.05rem;
152105
font-weight: 500;
153106
box-shadow: 0 4px 12px ${(props) => props.theme.whiteOneToBlackOne};
154107
transition:
@@ -158,8 +111,8 @@ const CanvasIllustrationWrapper = styled.div`
158111
color 0.6s ease;
159112
160113
.node-icon {
161-
width: 32px;
162-
height: 32px;
114+
width: 40px;
115+
height: 40px;
163116
margin-bottom: 8px;
164117
fill: currentColor;
165118
}
@@ -168,43 +121,42 @@ const CanvasIllustrationWrapper = styled.div`
168121
.canvas-node.compact {
169122
padding: 9px 14px;
170123
min-width: 96px;
171-
font-size: 0.82rem;
124+
font-size: 0.85rem;
172125
background: ${(props) => props.theme.grey212121ToWhite};
173126
174127
.node-icon {
175-
width: 24px;
176-
height: 24px;
128+
width: 30px;
129+
height: 30px;
177130
margin-bottom: 5px;
178131
}
179132
}
180133
181134
.canvas-node.mini {
182-
width: 42px;
183-
height: 42px;
135+
width: 44px;
136+
height: 44px;
184137
padding: 0;
185138
border-radius: 50%;
186-
font-size: 1.15rem;
139+
font-size: 1.2rem;
187140
font-weight: 800;
188141
background: ${(props) => props.theme.grey111111ToGreyFAFAFA};
189142
190143
.node-icon {
191-
width: 22px;
192-
height: 22px;
144+
width: 26px;
145+
height: 26px;
193146
margin-bottom: 0;
194147
}
195148
}
196149
197150
/* Hexagon shape for the center node */
198151
.canvas-node.hexagon {
199-
width: 120px;
200-
height: 120px;
152+
width: 125px;
153+
height: 125px;
201154
border-radius: 0;
202155
border: none;
203156
background: transparent;
204157
box-shadow: none;
205158
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
206159
background-color: ${(props) => props.theme.secondaryColor};
207-
color: ${(props) => props.theme.white};
208160
209161
&:before {
210162
content: "";
@@ -220,80 +172,103 @@ const CanvasIllustrationWrapper = styled.div`
220172
}
221173
222174
.node-icon {
175+
width: 48px;
176+
height: 48px;
223177
color: ${(props) => props.theme.secondaryColor};
224178
}
225179
}
226180
227181
/* Node positioning */
228182
.node-k8s {
229-
top: 20%;
230-
left: 10%;
183+
top: 12%;
184+
left: 12%;
231185
border-color: #326ce5;
232186
.node-icon {
233187
color: #326ce5;
234188
}
235189
}
236190
237191
.node-istio {
238-
top: 70%;
239-
left: 20%;
192+
top: 75%;
193+
left: 25%;
240194
border-color: #466bb0;
241195
.node-icon {
242196
color: #466bb0;
243197
}
244198
}
245199
200+
.node-academy.center-academy {
201+
position: absolute;
202+
top: 50.5%;
203+
left: 45.33%;
204+
transform: translate(-50%, -50%);
205+
z-index: 1;
206+
display: flex;
207+
align-items: center;
208+
justify-content: center;
209+
210+
.node-icon {
211+
width: 134px;
212+
height: 134px;
213+
opacity: 0.95;
214+
}
215+
}
216+
246217
.node-meshery {
247-
top: 40%;
248-
left: 45%;
218+
top: 56%;
219+
left: 16%;
249220
transform: translate(-50%, -50%);
221+
.node-icon {
222+
width: 56px;
223+
height: 56px;
224+
}
250225
}
251226
252227
.node-gitops {
253-
top: 30%;
254-
left: 70%;
228+
top: 35%;
229+
left: 62%;
255230
border-color: #ebc017;
256231
.node-icon {
257232
color: #ebc017;
258233
}
259234
}
260235
261236
.node-workshop {
262-
top: 16%;
263-
left: 62%;
237+
top: 10%;
238+
left: 70%;
264239
border-color: #00b39f;
265240
.node-icon {
266241
color: #00b39f;
267242
}
268243
}
269244
270245
.node-certification {
271-
top: 64%;
272-
left: 68%;
246+
top: 78%;
247+
left: 58%;
273248
border-color: #7a4bb5;
274249
.node-icon {
275250
color: #7a4bb5;
276251
}
277252
}
278253
279254
.node-quiz {
280-
top: 49%;
281-
left: 29%;
255+
top: 18%;
256+
left: 35%;
282257
color: #ffd200;
283258
border-color: #ffd200;
284259
}
285260
286261
.node-check {
287-
top: 53%;
288-
left: 56%;
262+
top: 82.5%;
263+
left: 85%;
289264
color: #00b39f;
290265
border-color: #00b39f;
291266
}
292267
293268
.learning-card {
294269
position: absolute;
295-
top: 76%;
296-
left: 38%;
270+
top: 60%;
271+
left: 65%;
297272
z-index: 4;
298273
display: flex;
299274
align-items: center;
@@ -353,8 +328,8 @@ const CanvasIllustrationWrapper = styled.div`
353328
354329
.progress-strip {
355330
position: absolute;
356-
top: 8%;
357-
left: 32%;
331+
top: 5%;
332+
left: 40%;
358333
z-index: 4;
359334
display: flex;
360335
align-items: center;
@@ -406,6 +381,12 @@ const CanvasIllustrationWrapper = styled.div`
406381
align-items: flex-start;
407382
animation: ${float1} 4s ease-in-out infinite;
408383
384+
@media (prefers-reduced-motion: reduce) {
385+
.cursor {
386+
animation: none;
387+
}
388+
}
389+
409390
svg {
410391
width: 20px;
411392
height: 20px;
@@ -428,8 +409,8 @@ const CanvasIllustrationWrapper = styled.div`
428409
}
429410
430411
.cursor-1 {
431-
top: 15%;
432-
left: 40%;
412+
top: 12%;
413+
left: 55%;
433414
svg path {
434415
fill: #7a4bb5;
435416
stroke: white;
@@ -442,7 +423,7 @@ const CanvasIllustrationWrapper = styled.div`
442423
443424
.cursor-2 {
444425
top: 65%;
445-
left: 60%;
426+
left: 25%;
446427
animation: ${float2} 5s ease-in-out infinite;
447428
svg path {
448429
fill: #e6522c;
@@ -454,11 +435,16 @@ const CanvasIllustrationWrapper = styled.div`
454435
}
455436
}
456437
457-
/* Comment block */
438+
@media (prefers-reduced-motion: reduce) {
439+
.cursor-2 {
440+
animation: none;
441+
}
442+
}
443+
458444
.comment-block {
459445
position: absolute;
460-
top: 25%;
461-
left: 55%;
446+
top: 30%;
447+
left: 74%;
462448
z-index: 5;
463449
background: ${(props) => props.theme.saffronColor};
464450
color: ${(props) => props.theme.black};
@@ -499,6 +485,10 @@ const CanvasIllustrationWrapper = styled.div`
499485
width: 90px;
500486
height: 90px;
501487
}
488+
.node-academy.center-academy .node-icon {
489+
width: 100px;
490+
height: 100px;
491+
}
502492
.canvas-node.compact {
503493
min-width: 82px;
504494
padding: 7px 10px;
@@ -522,25 +512,33 @@ const CanvasIllustrationWrapper = styled.div`
522512
}
523513
524514
@media (max-width: 500px) {
525-
.node-gitops {
526-
top: 70%;
527-
left: 70%;
528-
}
529515
.node-k8s {
530516
top: 15%;
531517
left: 10%;
532518
}
519+
.node-istio {
520+
top: 75%;
521+
left: 30%;
522+
}
523+
.node-meshery {
524+
top: 58%;
525+
left: 18%;
526+
}
527+
.node-gitops {
528+
top: 40%;
529+
left: 80%;
530+
}
533531
.cursor-1 {
534-
top: 10%;
532+
top: 15%;
535533
left: 55%;
536534
}
537535
.node-workshop {
538-
top: 14%;
539-
left: 62%;
536+
top: 15%;
537+
left: 65%;
540538
}
541539
.node-certification {
542-
top: 60%;
543-
left: 58%;
540+
top: 70%;
541+
left: 73%;
544542
}
545543
.node-quiz,
546544
.node-check,

0 commit comments

Comments
 (0)