@@ -198,16 +198,16 @@ def:pub Sidebar(props: dict) -> JsxElement {
198198 { showColor and <div >
199199 <span className = " sidebar-label" >Stroke </span >
200200 <div className = " grid grid-cols-5 gap-1.5 mt-1.5" >
201- { presetColors.map(lambda color: any -> any {
202- isSelected = activeColor == color;
203- return <button
201+ { [
202+ <button
204203 key = { color}
205204 onClick = { lambda -> None { handleColorChange(color); }}
206205 title = { color}
207- className = { " w-7 h-7 rounded-full transition-all duration-150 border border-gray-200/60 " + (isSelected and " ring-2 ring-orange-500 ring-offset-1 scale-110" or " hover:scale-110" )}
206+ className = { " w-7 h-7 rounded-full transition-all duration-150 border border-gray-200/60 " + (activeColor == color and " ring-2 ring-orange-500 ring-offset-1 scale-110" or " hover:scale-110" )}
208207 style = { {" backgroundColor" : color}}
209- />;
210- })}
208+ />
209+ for color in presetColors
210+ ]}
211211 </div >
212212 <input
213213 type = " color"
@@ -256,16 +256,16 @@ def:pub Sidebar(props: dict) -> JsxElement {
256256 { showShapeTextColor and <div >
257257 <span className = " sidebar-label" >Text Color </span >
258258 <div className = " grid grid-cols-5 gap-1.5 mt-1.5" >
259- { presetColors.map(lambda stcColor: any -> any {
260- stcSelected = activeShapeTextColor == stcColor;
261- return <button
259+ { [
260+ <button
262261 key = { stcColor}
263262 onClick = { lambda -> None { handleShapeTextColorChange(stcColor); }}
264263 title = { stcColor}
265- className = { " w-7 h-7 rounded-full transition-all duration-150 border border-gray-200/60 " + (stcSelected and " ring-2 ring-orange-500 ring-offset-1 scale-110" or " hover:scale-110" )}
264+ className = { " w-7 h-7 rounded-full transition-all duration-150 border border-gray-200/60 " + (activeShapeTextColor == stcColor and " ring-2 ring-orange-500 ring-offset-1 scale-110" or " hover:scale-110" )}
266265 style = { {" backgroundColor" : stcColor}}
267- />;
268- })}
266+ />
267+ for stcColor in presetColors
268+ ]}
269269 </div >
270270 <input
271271 type = " color"
@@ -297,25 +297,25 @@ def:pub Sidebar(props: dict) -> JsxElement {
297297 { showLineStyle and <div >
298298 <span className = " sidebar-label" >Line Style </span >
299299 <div className = " flex items-center gap-1 mt-1.5" >
300- { lineStyles.map(lambda style: any -> any {
301- isActive = activeLineStyle == style.id;
302- return <button
300+ { [
301+ <button
303302 key = { style.id}
304303 onClick = { lambda -> None { handleLineStyleChange(style.id); }}
305304 title = { style.label}
306- className = { " flex-1 h-8 rounded-lg flex items-center justify-center transition-all duration-150 " + (isActive and " bg-orange-50 ring-1 ring-orange-200" or " bg-gray-50 hover:bg-gray-100" )}
305+ className = { " flex-1 h-8 rounded-lg flex items-center justify-center transition-all duration-150 " + (activeLineStyle == style.id and " bg-orange-50 ring-1 ring-orange-200" or " bg-gray-50 hover:bg-gray-100" )}
307306 >
308307 <svg width = " 32" height = " 4" viewBox = " 0 0 32 4" >
309308 <line
310309 x1 = " 2" y1 = " 2" x2 = " 30" y2 = " 2"
311- stroke = { isActive and " #ea580c" or " #9ca3af" }
310+ stroke = { activeLineStyle == style.id and " #ea580c" or " #9ca3af" }
312311 strokeWidth = " 2"
313312 strokeLinecap = " round"
314313 strokeDasharray = { style.id == " dashed" and " 6,4" or (style.id == " dotted" and " 2,4" or " none" )}
315314 />
316315 </svg >
317- </button >;
318- })}
316+ </button >
317+ for style in lineStyles
318+ ]}
319319 </div >
320320 </div > or None }
321321
@@ -339,34 +339,34 @@ def:pub Sidebar(props: dict) -> JsxElement {
339339 <div className = " h-px bg-gray-100 mb-3" ></div >
340340 <span className = " sidebar-label" >Font </span >
341341 <div className = " flex flex-col gap-0.5 mt-1.5" >
342- { fonts.map(lambda font: any -> any {
343- isActive = activeFontFamily == font.id;
344- return <button
342+ { [
343+ <button
345344 key = { font.id}
346345 onClick = { lambda -> None { handleFontFamilyChange(font.id); }}
347346 title = { font.id}
348- className = { " px-2 h-7 rounded-md flex items-center text-xs font-medium transition-all duration-150 whitespace-nowrap " + (isActive and " bg-orange-50 text-orange-700 ring-1 ring-orange-200" or " text-gray-500 hover:bg-gray-50" )}
347+ className = { " px-2 h-7 rounded-md flex items-center text-xs font-medium transition-all duration-150 whitespace-nowrap " + (activeFontFamily == font.id and " bg-orange-50 text-orange-700 ring-1 ring-orange-200" or " text-gray-500 hover:bg-gray-50" )}
349348 style = { {" fontFamily" : font.id}}
350349 >
351350 { font.label}
352- </button >;
353- })}
351+ </button >
352+ for font in fonts
353+ ]}
354354 </div >
355355 </div > or None }
356356
357357 { showFontSize and <div >
358358 <span className = " sidebar-label mt-3" >Size </span >
359359 <div className = " grid grid-cols-3 gap-1 mt-1.5" >
360- { fontSizes.map(lambda size: any -> any {
361- isActive = activeFontSize == size;
362- return <button
360+ { [
361+ <button
363362 key = { size}
364363 onClick = { lambda -> None { handleFontSizeChange(size); }}
365- className = { " h-7 rounded-md flex items-center justify-center text-xs font-medium transition-all duration-150 " + (isActive and " bg-orange-50 text-orange-700 ring-1 ring-orange-200" or " text-gray-500 hover:bg-gray-50" )}
364+ className = { " h-7 rounded-md flex items-center justify-center text-xs font-medium transition-all duration-150 " + (activeFontSize == size and " bg-orange-50 text-orange-700 ring-1 ring-orange-200" or " text-gray-500 hover:bg-gray-50" )}
366365 >
367366 { size}
368- </button >;
369- })}
367+ </button >
368+ for size in fontSizes
369+ ]}
370370 </div >
371371 </div > or None }
372372 </div >;
0 commit comments