-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
1,179 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script lang="ts"> | ||
import TextButton from './TextButton.svelte'; | ||
import Modal from './modal.svelte'; | ||
let showModal = false; | ||
</script> | ||
|
||
<div class="blog-header"> | ||
<ul class="filters"> | ||
<li> | ||
<TextButton | ||
label="tags" | ||
onChange={() => { | ||
showModal = true; | ||
}} | ||
/> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<Modal bind:showModal> | ||
<h3 slot="modal-header">Tags</h3> | ||
<p> | ||
<b>Hello</b> | ||
</p> | ||
</Modal> | ||
|
||
<style> | ||
ul { | ||
list-style: none; | ||
padding: 0; | ||
} | ||
.filters { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
gap: 15px; | ||
margin-block: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
import { fly } from 'svelte/transition'; | ||
let copiedText = false; | ||
let copyTimeout = 200; | ||
onMount(() => { | ||
let pres: HTMLCollection = document.getElementsByTagName('pre'); | ||
for (let _ of pres) { | ||
const pre = _ as HTMLPreElement; | ||
const text = pre.innerText; | ||
let copyButton = document.createElement('button'); | ||
copyButton.addEventListener( | ||
'click', | ||
() => ( | ||
navigator.clipboard.writeText(text), | ||
(copiedText = true), | ||
copyTimeout && clearTimeout(copyTimeout), | ||
(copyTimeout = setTimeout(() => (copiedText = false), 1500)) | ||
) | ||
); | ||
pre.style.position = 'relative'; | ||
copyButton.style.backgroundColor = '#1f1f1f'; | ||
copyButton.style.color = '#f1f1f1'; | ||
copyButton.style.fontSize = '12px'; | ||
copyButton.style.margin = '0px 5px 5px 0px'; | ||
copyButton.style.borderStyle = 'none'; | ||
copyButton.style.borderRadius = '3px'; | ||
copyButton.style.padding = '3px 8px'; | ||
copyButton.style.position = 'absolute'; | ||
copyButton.style.bottom = '0px'; | ||
copyButton.style.right = '0px'; | ||
copyButton.style.cursor = 'pointer'; | ||
copyButton.className = 'copy'; | ||
copyButton.innerText = 'copy'; | ||
pre.appendChild(copyButton); | ||
} | ||
}); | ||
</script> | ||
|
||
{#if copiedText} | ||
<div in:fly={{ y: -100 }} out:fly={{ y: -100 }} class="copy-tooltip">copied to clipboard</div> | ||
{/if} | ||
|
||
<slot /> | ||
|
||
<style> | ||
.copy-tooltip { | ||
background-color: rgba(0, 0, 0, 0.8); | ||
color: var(--body); | ||
position: fixed; | ||
padding: 0.4em 0.7em; | ||
border-radius: 0.4em; | ||
left: 50%; | ||
transform: translate(-50%, 0); | ||
top: 10px; | ||
z-index: 1; | ||
box-shadow: 0px 2px 10px -2px var(--code-copy); | ||
} | ||
</style> |
Oops, something went wrong.