StatCardComponent.vala 680 B

1234567891011121314151617181920212223242526
  1. using Spry;
  2. /**
  3. * StatCardComponent - A statistics display card
  4. *
  5. * Shows a large value with a label underneath
  6. */
  7. public class StatCardComponent : Component {
  8. public string value { set; get; default = "0"; }
  9. public string label { set; get; default = "Stat"; }
  10. public override string markup { get {
  11. return """
  12. <div class="stat-card">
  13. <div class="stat-value" sid="value"></div>
  14. <div class="stat-label" sid="label"></div>
  15. </div>
  16. """;
  17. }}
  18. public override async void prepare() throws Error {
  19. this["value"].text_content = value;
  20. this["label"].text_content = label;
  21. }
  22. }