feat: add button component

This commit is contained in:
Vojtech Simetka 2022-11-23 17:52:25 +01:00
parent 2e579129b2
commit 7c9c4faf2f
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<script lang="ts">
export let variant: 'light' | 'dark' = 'light';
</script>
<button class={`${variant} root`}>
<slot />
</button>
<style>
.root {
padding: 15px;
border: 1px solid var(--color-black);
border-radius: 50px;
cursor: pointer;
transition: 1s;
}
.light,
.dark:hover {
color: var(--color-black);
background-color: var(--color-white);
border-color: var(--color-light-grey);
}
.dark,
.light:hover {
color: var(--color-white);
background-color: var(--color-black);
border-color: var(--color-light-black);
}
</style>

11
src/routes/+page.svelte Normal file
View File

@ -0,0 +1,11 @@
<script lang="ts">
import './styles.css';
import Header from '$lib/components/header.svelte';
import Button from '$lib/components/button.svelte';
</script>
<div>
<Header />
<Button>Light Button</Button>
<Button variant="dark">Dark Button</Button>
</div>