aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-02-04 21:13:02 +0800
committerMistivia <i@mistivia.com>2025-02-04 21:13:02 +0800
commit781917675a1f7a81d61dca8e5134fb4867750685 (patch)
tree6156b81e42d46fddc8ad2e518cf070c0891224bc /src/components
init
Diffstat (limited to 'src/components')
-rw-r--r--src/components/CardThumb.svelte21
-rw-r--r--src/components/LeftPanel.svelte40
-rw-r--r--src/components/MainPanel.svelte104
-rw-r--r--src/components/RightPanel.svelte79
4 files changed, 244 insertions, 0 deletions
diff --git a/src/components/CardThumb.svelte b/src/components/CardThumb.svelte
new file mode 100644
index 0000000..6dcefd2
--- /dev/null
+++ b/src/components/CardThumb.svelte
@@ -0,0 +1,21 @@
+<script lang="ts">
+ let {id} = $props()
+</script>
+
+<div class="card-thumbnail">
+ {#if id}
+ <img height="100%" src="https://cdn.233.momobako.com/ygopro/pics/{id}.jpg!half" alt="yugioh card {id}">
+ {/if}
+</div>
+
+<style>
+
+.card-thumbnail {
+ width: 50px;
+ height: 70px;
+ background-color: #eee;
+ margin-right: 10px;
+ border-radius: 3px;
+}
+
+</style>
diff --git a/src/components/LeftPanel.svelte b/src/components/LeftPanel.svelte
new file mode 100644
index 0000000..e05f42d
--- /dev/null
+++ b/src/components/LeftPanel.svelte
@@ -0,0 +1,40 @@
+<script lang="ts">
+ let leftPanelCardId = $state();
+ let leftPanelCardDesc = $state("");
+</script>
+
+<div class="left-panel">
+ <div class="card-preview">
+ <div class="card-image-large">
+ {#if leftPanelCardId}
+ <img height="100%" src="https://cdn.233.momobako.com/ygopro/pics/{leftPanelCardId}.jpg" alt="card img">
+ {/if}
+ </div>
+ <div class="card-description">
+ <pre>{leftPanelCardDesc}</pre>
+ </div>
+ </div>
+</div>
+
+<style>
+
+.left-panel {
+ width: 25%;
+ padding: 20px;
+ background-color: #f5f5f5;
+}
+
+.card-image-large {
+ height: 400px;
+ text-align: center;
+ background-color: #ddd;
+ margin-bottom: 20px;
+ border-radius: 8px;
+}
+
+.card-description {
+ line-height: 1.6;
+ font-size: 14px;
+}
+
+</style>
diff --git a/src/components/MainPanel.svelte b/src/components/MainPanel.svelte
new file mode 100644
index 0000000..10f18d8
--- /dev/null
+++ b/src/components/MainPanel.svelte
@@ -0,0 +1,104 @@
+<script lang="ts">
+
+import CardThumb from './CardThumb.svelte';
+
+let mainDeck = $state([]);
+let extraDeck = $state([]);
+let sideDeck = $state([]);
+let mainNum = $derived(mainDeck.length);
+let extraNum = $derived(extraDeck.length);
+let sideNum = $derived(sideDeck.length);
+
+</script>
+
+<div class="middle-panel">
+ <div class="control-bar">
+ <button class="btn">打开</button>
+ <button class="btn">保存</button>
+ </div>
+ <div class="deck-section">
+ <div class="deck-group">
+ <h3>主卡组({mainNum})</h3>
+ <div class="card-grid main-deck">
+ {#each mainDeck as card}
+ <div class="card-grid-thumb">
+ <CardThumb id={card} />
+ </div>
+ {/each}
+ </div>
+ </div>
+ <div class="deck-group">
+ <h3>额外卡组({extraNum})</h3>
+ <div class="card-grid extra-deck">
+ {#each extraDeck as card}
+ <div class="card-grid-thumb">
+ <CardThumb id={card} />
+ </div>
+ {/each}
+ </div>
+ </div>
+ <div class="deck-group">
+ <h3>副卡组({sideNum})</h3>
+ <div class="card-grid side-deck">
+ {#each sideDeck as card}
+ <div class="card-grid-thumb">
+ <CardThumb id={card} />
+ </div>
+ {/each}
+ </div>
+ </div>
+ </div>
+</div>
+
+<style>
+
+.middle-panel {
+ width: 55%;
+ padding: 20px;
+ background-color: #fff;
+ overflow-y: auto;
+}
+
+.control-bar {
+ margin-bottom: 20px;
+}
+
+.btn {
+ padding: 8px 20px;
+ margin-right: 10px;
+ background-color: #4CAF50;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+.deck-group {
+ margin-bottom: 30px;
+}
+
+.deck-group h3 {
+ margin-bottom: 10px;
+ color: #333;
+}
+
+.card-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
+ gap: 5px;
+ grid-auto-flow: dense;
+ overflow-y: auto;
+ padding: 10px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ min-height: 80px;
+}
+
+.card-grid-thumb {
+ background-color: #eee;
+ aspect-ratio: 1/1.4;
+ border-radius: 5px;
+}
+
+
+</style>
diff --git a/src/components/RightPanel.svelte b/src/components/RightPanel.svelte
new file mode 100644
index 0000000..d0480fe
--- /dev/null
+++ b/src/components/RightPanel.svelte
@@ -0,0 +1,79 @@
+<script lang="ts">
+
+import CardThumb from './CardThumb.svelte';
+
+let cardList = $state([]);
+
+</script>
+
+<div class="right-panel">
+ <div class="search-bar">
+ <input type="text" placeholder="搜索卡牌...">
+ </div>
+ <div class="card-list">
+ {#if cardList.length > 0}
+ <div class="card-item">
+ {#each cardList as card}
+ <CardThumb id= {card.id} />
+ <span>{card.name}</span>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ <div class="pagination">
+ <button class="page-btn">上一页</button>
+ <button class="page-btn">下一页</button>
+ </div>
+</div>
+
+
+<style>
+
+.right-panel {
+ width: 20%;
+ padding: 20px;
+ background-color: #f8f8f8;
+ display: flex;
+ flex-direction: column;
+}
+
+.search-bar input {
+ width: 100%;
+ padding: 8px;
+ margin-bottom: 15px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+}
+
+.card-list {
+ flex-grow: 1;
+ overflow-y: auto;
+ margin-bottom: 15px;
+}
+
+.card-item {
+ display: flex;
+ align-items: center;
+ padding: 8px;
+ margin-bottom: 5px;
+ background-color: white;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+.pagination {
+ display: flex;
+ gap: 10px;
+}
+
+.page-btn {
+ flex: 1;
+ padding: 8px;
+ background-color: #007bff;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+</style>