piclets / src /lib /components /Battle /ActionButtons.svelte
Fraser's picture
MORE
7428b13
raw
history blame
2.99 kB
<script lang="ts">
export let isWildBattle: boolean;
export let onAction: (action: string) => void;
</script>
<div class="action-grid">
<button class="action-button fight" on:click={() => onAction('fight')}>
<span class="action-icon">βš”οΈ</span>
<span class="action-label">Fight</span>
</button>
<button class="action-button piclet" on:click={() => onAction('piclet')}>
<span class="action-icon">πŸ”„</span>
<span class="action-label">Piclet</span>
</button>
{#if isWildBattle}
<button class="action-button catch" on:click={() => onAction('catch')}>
<span class="action-icon">🎯</span>
<span class="action-label">Catch</span>
</button>
{:else}
<button class="action-button items" disabled>
<span class="action-icon">πŸŽ’</span>
<span class="action-label">Items</span>
</button>
{/if}
<button class="action-button run" on:click={() => onAction('run')}>
<span class="action-icon">πŸƒ</span>
<span class="action-label">Run</span>
</button>
</div>
<style>
.action-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
max-width: 400px;
margin: 0 auto;
width: 100%;
}
.action-button {
padding: 2rem 1rem;
background: #f8f9fa;
border: 2px solid #e0e0e0;
border-radius: 12px;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
transition: all 0.2s ease;
position: relative;
overflow: hidden;
}
.action-button:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.action-button:active:not(:disabled) {
transform: translateY(0);
}
.action-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.action-icon {
font-size: 2rem;
}
.action-label {
font-weight: 600;
font-size: 1rem;
color: #333;
}
/* Action specific colors */
.fight {
background: #ffebee;
border-color: #ef5350;
}
.fight:hover:not(:disabled) {
background: #ffcdd2;
border-color: #e53935;
}
.piclet {
background: #e3f2fd;
border-color: #42a5f5;
}
.piclet:hover:not(:disabled) {
background: #bbdefb;
border-color: #2196f3;
}
.catch {
background: #e8f5e9;
border-color: #66bb6a;
}
.catch:hover:not(:disabled) {
background: #c8e6c9;
border-color: #4caf50;
}
.items {
background: #fff3e0;
border-color: #ffa726;
}
.items:hover:not(:disabled) {
background: #ffe0b2;
border-color: #ff9800;
}
.run {
background: #f3e5f5;
border-color: #ab47bc;
}
.run:hover:not(:disabled) {
background: #e1bee7;
border-color: #9c27b0;
}
@media (max-width: 480px) {
.action-button {
padding: 1.5rem 0.75rem;
}
.action-icon {
font-size: 1.5rem;
}
.action-label {
font-size: 0.875rem;
}
}
</style>