FeatureCardComponent.vala 983 B

12345678910111213141516171819202122232425262728293031
  1. using Spry;
  2. /**
  3. * FeatureCardComponent - A reusable feature card
  4. *
  5. * Displays an icon, title, and description in a styled card
  6. */
  7. public class FeatureCardComponent : Component {
  8. public string icon { set; get; default = "purple"; }
  9. public string icon_emoji { set; get; default = "⭐"; }
  10. public string title { set; get; default = "Feature"; }
  11. public string description { set; get; default = "Description"; }
  12. public override string markup { get {
  13. return """
  14. <div class="feature-card">
  15. <div class="feature-icon" sid="icon"></div>
  16. <h3 sid="title"></h3>
  17. <p sid="description"></p>
  18. </div>
  19. """;
  20. }}
  21. public override async void prepare() throws Error {
  22. this["icon"].text_content = icon_emoji;
  23. this["icon"].set_attribute("class", @"feature-icon $icon");
  24. this["title"].text_content = title;
  25. this["description"].text_content = description;
  26. }
  27. }