feat(icons): replace inline SVGs with consistent JSX properties for icons

This commit is contained in:
shay
2026-04-18 13:17:00 -04:00
parent 12fb6c331b
commit 5198eab86a
4 changed files with 71 additions and 38 deletions
+2 -1
View File
@@ -18,7 +18,8 @@ def _achievement_icon_svg(icon_type: str, color: str) -> str:
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="{color}" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>''',
"star": f'''<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" fill="{color}" opacity="0.85"/>
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="{color}" stroke-width="1.5" stroke-linejoin="round"/>
</svg>''',
"hackathon": f'''<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="{color}" stroke-width="1.5"/>
+12 -1
View File
@@ -5,6 +5,17 @@ from ..models import GradeData
from ..themes import THEMES, TAG_COLORS, GRADE_COLORS
from ..utils import escape, card_wrapper, icon_svg
# Tokens that should render uppercase instead of title-cased (e.g. "ml-engineer"
# → "ML Engineer", not "Ml Engineer").
_TAG_ACRONYMS = {"ml", "ai", "ui", "ux", "api", "cli", "sql", "css", "html", "js", "ios"}
def _format_tag_label(tag: str) -> str:
return " ".join(
w.upper() if w.lower() in _TAG_ACRONYMS else w.capitalize()
for w in tag.split("-")
)
def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dict | None = None) -> str:
"""Renders the developer grade widget with stats and tags.
@@ -63,7 +74,7 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
for tag in (data.tags or []):
tag_color = TAG_COLORS.get(tag.tag, t["accent"])
label = tag.tag.replace("-", " ").title()
label = _format_tag_label(tag.tag)
tw = int(len(label) * 6.6 + 18)
pill_opacity = 0.9 if tag.source == "earned" else 0.55