mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-25 15:32:31 +00:00
39 lines
789 B
Svelte
39 lines
789 B
Svelte
<script lang="ts">
|
|
import CopyButton from '$components/CopyButton.svelte'
|
|
import { dbg } from '$util/logger'
|
|
import { Highlight } from 'svelte-highlight'
|
|
import { typescript } from 'svelte-highlight/languages'
|
|
import 'svelte-highlight/styles/github.css'
|
|
|
|
export let code: string
|
|
const handleCopy = () => {
|
|
dbg('copied')
|
|
}
|
|
</script>
|
|
|
|
<div class="copy-container">
|
|
<Highlight class="pre" language={typescript} {code} />
|
|
|
|
<div class="copy-button">
|
|
<CopyButton {code} copy={handleCopy} />
|
|
</div>
|
|
</div>
|
|
|
|
<style lang="scss">
|
|
.copy-container {
|
|
position: relative;
|
|
margin: 5px;
|
|
border: 1px solid gray;
|
|
|
|
.copy-button {
|
|
position: absolute;
|
|
top: 2px;
|
|
right: 2px;
|
|
}
|
|
|
|
.pre{
|
|
margin-bottom: 0 ;
|
|
}
|
|
}
|
|
</style>
|