sveltacular 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sveltacular is TypeScript and SASS based component library for Svelte, with no other dependencies.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Why did I create it when there are other options? Well, mainly because the best options out there were based on Tailwind. And, no disrespect to those who love it, but I didn't want to use Tailwind. So since I didn't find what I was loooking for, I made my own.
|
|
6
6
|
|
|
7
7
|
## Run Storybook
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
I don't have great documentation for now, but you can browse all of the available components by running Storybook locally. Check out the repo and then run this command:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
10
12
|
npm run storybook
|
|
11
13
|
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Install it in your project
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm i sveltacular
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then use it like this:
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
import { Button } from 'sveltacular';
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<Button>Hello World</Button>
|
|
31
|
+
```
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
|
|
1
|
+
<script>import { navigateTo } from "../../index.js";
|
|
2
|
+
import { createEventDispatcher, getContext } from "svelte";
|
|
3
|
+
export let href = void 0;
|
|
3
4
|
export let title;
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
4
6
|
const open = getContext("app-nav-state");
|
|
7
|
+
const click = () => {
|
|
8
|
+
if (href)
|
|
9
|
+
navigateTo(href);
|
|
10
|
+
dispatch("click");
|
|
11
|
+
};
|
|
5
12
|
</script>
|
|
6
13
|
|
|
7
|
-
<
|
|
14
|
+
<button class={$open ? 'open' : 'closed'} on:click={click}>
|
|
8
15
|
{#if $$slots.default}
|
|
9
16
|
<div class="icon">
|
|
10
17
|
<slot />
|
|
11
18
|
</div>
|
|
12
19
|
{/if}
|
|
13
|
-
<div class="title">
|
|
14
|
-
|
|
20
|
+
<div class="title">
|
|
21
|
+
{title}
|
|
22
|
+
</div>
|
|
23
|
+
</button>
|
|
15
24
|
|
|
16
|
-
<style>
|
|
25
|
+
<style>button {
|
|
17
26
|
display: flex;
|
|
18
27
|
flex-direction: column;
|
|
19
28
|
gap: 0.2rem;
|
|
@@ -21,31 +30,36 @@ const open = getContext("app-nav-state");
|
|
|
21
30
|
height: 100%;
|
|
22
31
|
color: var(--nav-link-color, black);
|
|
23
32
|
text-decoration: none;
|
|
33
|
+
appearance: none;
|
|
34
|
+
border: none;
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
cursor: pointer;
|
|
24
37
|
}
|
|
25
|
-
|
|
38
|
+
button:hover {
|
|
26
39
|
color: var(--nav-link-hover-color, black);
|
|
27
40
|
text-decoration: underline;
|
|
28
41
|
}
|
|
29
|
-
|
|
42
|
+
button .icon {
|
|
30
43
|
width: 100%;
|
|
31
44
|
height: 1.5rem;
|
|
32
45
|
}
|
|
33
46
|
|
|
34
47
|
@media (max-width: 640px) {
|
|
35
|
-
|
|
48
|
+
button.open {
|
|
36
49
|
flex-direction: row;
|
|
37
50
|
gap: 1rem;
|
|
38
51
|
width: 100%;
|
|
39
52
|
padding: 1rem;
|
|
53
|
+
text-align: left;
|
|
40
54
|
}
|
|
41
|
-
|
|
55
|
+
button.open:hover {
|
|
42
56
|
text-decoration: none;
|
|
43
57
|
background-color: #bbb;
|
|
44
58
|
}
|
|
45
|
-
|
|
59
|
+
button.open .title {
|
|
46
60
|
flex-grow: 1;
|
|
47
61
|
}
|
|
48
|
-
|
|
62
|
+
button.open .icon {
|
|
49
63
|
width: 1.5rem;
|
|
50
64
|
}
|
|
51
65
|
}</style>
|