Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 88 additions & 34 deletions src/lib/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,62 +1,116 @@
<script lang="ts">
export let href: string | undefined = undefined;
export let color: string = '#2196f3';
export let className: string = '';

let currentBg = color;
export let variant: 'primary' | 'secondary' | 'outline' = 'primary';
export let size: 'sm' | 'md' | 'lg' = 'md';
export let disabled: boolean = false;
</script>

{#if href}
<a {href} class={className} style="text-decoration: none; color: inherit;">
<button
class="btn"
style="background-color: {currentBg};"
on:mouseover={() => (currentBg = '#1976d2')}
on:mouseout={() => (currentBg = color)}
on:focus={() => (currentBg = '#1976d2')}
on:blur={() => (currentBg = color)}
>
<slot />
</button>
<a {href} class="btn {variant} {size}" class:disabled>
<slot />
</a>
{:else}
<button
class="btn {className}"
style="background-color: {currentBg};"
on:click
on:mouseover={() => (currentBg = '#1976d2')}
on:mouseout={() => (currentBg = color)}
on:focus={() => (currentBg = '#1976d2')}
on:blur={() => (currentBg = color)}
>
<button class="btn {variant} {size}" {disabled} on:click>
<slot />
</button>
{/if}

<style>
.btn {
padding: 10px 24px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
border-radius: 8px;
border: 2px solid #1976d2;
color: white;
font-weight: 500;
font-size: 1rem;
font-family: inherit;
cursor: pointer;
transition: background 0.2s;
pointer-events: all;
transition: all 0.2s ease;
text-decoration: none;
border: 2px solid transparent;
white-space: nowrap;
}

/* Sizes */
.sm {
padding: 0.4rem 0.8rem;
font-size: 0.85rem;
}

.md {
padding: 0.6rem 1.25rem;
font-size: 0.95rem;
}

.lg {
padding: 0.75rem 1.75rem;
font-size: 1.1rem;
}

/* Variants */
.primary {
background-color: #ec3750;
color: #fff;
border-color: #ec3750;
}

.primary:hover:not(:disabled) {
background-color: #d42f45;
border-color: #d42f45;
}

.secondary {
background-color: rgba(255, 255, 255, 0.15);
color: #fff;
border-color: rgba(255, 255, 255, 0.3);
}

.secondary:hover:not(:disabled) {
background-color: rgba(255, 255, 255, 0.25);
border-color: rgba(255, 255, 255, 0.5);
}

.outline {
background-color: transparent;
color: #fff;
border-color: #fff;
}

.outline:hover:not(:disabled) {
background-color: rgba(255, 255, 255, 0.1);
}

.btn:disabled,
.btn.disabled {
opacity: 0.5;
cursor: not-allowed;
}

.btn:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
}

@media (max-width: 768px) {
.btn {
padding: 8px 18px;
.sm {
padding: 0.35rem 0.7rem;
font-size: 0.8rem;
}

.md {
padding: 0.5rem 1rem;
font-size: 0.9rem;
}

.lg {
padding: 0.6rem 1.25rem;
font-size: 1rem;
}
}

@media (max-width: 480px) {
.btn {
padding: 6px 14px;
.md {
padding: 0.45rem 0.9rem;
font-size: 0.85rem;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/lib/ChristmasAnimation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,6 @@
<style>
@import url('https://fonts.googleapis.com/css?family=Luckiest+Guy');



#container {
width: 100vw;
height: 100vh;
Expand Down Expand Up @@ -1060,7 +1058,7 @@
cursor: pointer;
}

:global(svg) {
#container svg {
width: 100%;
height: 100%;
overflow: visible;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ChristmasAnimationNoPresents.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@
cursor: pointer;
}

:global(svg) {
#container svg {
width: 100%;
height: 100%;
overflow: visible;
Expand Down
Loading