Game.svelte 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <script>
  2. let { game } = $props();
  3. function formatDate(dateStr) {
  4. return new Date(dateStr).toLocaleDateString("en-US", {
  5. month: "short", day: "numeric", year: "numeric"
  6. });
  7. }
  8. </script>
  9. <a href={`/game/${game.id}`} class="game-card">
  10. <div class="game-icon">
  11. <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
  12. <path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/>
  13. <path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>
  14. <path d="M8 7h8M8 11h5"/>
  15. </svg>
  16. </div>
  17. <div class="game-info">
  18. <h2>{game.title}</h2>
  19. <p class="context">{game.world_context}</p>
  20. <p class="date">Started {formatDate(game.created_at)}</p>
  21. </div>
  22. <div class="game-arrow">
  23. <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  24. <path d="M5 12h14M12 5l7 7-7 7"/>
  25. </svg>
  26. </div>
  27. </a>
  28. <style>
  29. .game-card {
  30. display: flex;
  31. align-items: center;
  32. gap: 1.25rem;
  33. padding: 1.25rem 1.5rem;
  34. background: #0f0f18;
  35. border: 1px solid #1e1e28;
  36. border-radius: 12px;
  37. text-decoration: none;
  38. color: inherit;
  39. transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  40. position: relative;
  41. overflow: hidden;
  42. }
  43. .game-card::before {
  44. content: "";
  45. position: absolute;
  46. inset: 0;
  47. background: radial-gradient(ellipse at left, rgba(192, 132, 252, 0.06) 0%, transparent 70%);
  48. opacity: 0;
  49. transition: opacity 0.2s;
  50. }
  51. .game-card:hover {
  52. border-color: #c084fc;
  53. transform: translateX(4px);
  54. box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  55. }
  56. .game-card:hover::before {
  57. opacity: 1;
  58. }
  59. .game-icon {
  60. width: 44px;
  61. height: 44px;
  62. border-radius: 10px;
  63. background: rgba(192, 132, 252, 0.1);
  64. color: #c084fc;
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. flex-shrink: 0;
  69. }
  70. .game-info {
  71. flex: 1;
  72. min-width: 0;
  73. }
  74. .game-info h2 {
  75. font-size: 1rem;
  76. font-weight: 600;
  77. color: #e5e5ea;
  78. letter-spacing: -0.2px;
  79. white-space: nowrap;
  80. overflow: hidden;
  81. text-overflow: ellipsis;
  82. }
  83. .context {
  84. font-size: 0.85rem;
  85. color: #6b6b7a;
  86. margin-top: 0.25rem;
  87. white-space: nowrap;
  88. overflow: hidden;
  89. text-overflow: ellipsis;
  90. }
  91. .date {
  92. font-size: 0.75rem;
  93. color: #44445a;
  94. margin-top: 0.2rem;
  95. }
  96. .game-arrow {
  97. color: #3a3a50;
  98. flex-shrink: 0;
  99. transition: color 0.2s, transform 0.2s;
  100. }
  101. .game-card:hover .game-arrow {
  102. color: #c084fc;
  103. transform: translateX(3px);
  104. }
  105. </style>