WIP React > Svelte
Put most of the developed design into Svelte
This commit is contained in:
15
src/atoms/Button.svelte
Normal file
15
src/atoms/Button.svelte
Normal file
@@ -0,0 +1,15 @@
|
||||
<script>
|
||||
export let href
|
||||
export let type
|
||||
export let text = ''
|
||||
|
||||
// Transformed text into spans
|
||||
const textSpans = text
|
||||
.replace(/(<.*?>)|(.)/g, letter => letter.replace(/./g, '<span>$&</span>'))
|
||||
.replace(/ /g, '\u00a0')
|
||||
</script>
|
||||
|
||||
<a {href} class={type} aria-label={text} data-text={text}>
|
||||
<slot></slot>
|
||||
{@html textSpans}
|
||||
</a>
|
||||
Reference in New Issue
Block a user