aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Code.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-03-17 20:28:00 -0700
committerAdam Soltys <[email protected]>2023-03-17 20:28:00 -0700
commit93f23786af35bbe932bc849c8a301d5af1b82d58 (patch)
treed7d6d408fb34ec1892b67aa56398cffe726d0eab /src/components/Code.svelte
parentc4757b998cd9be2db18ac1805557bdf175fc86c3 (diff)
parentcdc3a2677c8728af27084024daba288153c2bd52 (diff)
downloadcoinos-ui-93f23786af35bbe932bc849c8a301d5af1b82d58.tar.gz
coinos-ui-93f23786af35bbe932bc849c8a301d5af1b82d58.zip
Merge branch 'master' into hashme
Diffstat (limited to 'src/components/Code.svelte')
-rw-r--r--src/components/Code.svelte29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/Code.svelte b/src/components/Code.svelte
new file mode 100644
index 00000000..a718c5ed
--- /dev/null
+++ b/src/components/Code.svelte
@@ -0,0 +1,29 @@
+<script>
+ import { copy } from '$lib/utils';
+ import { Icon } from '$comp';
+ import samples from '$lib/samples';
+ export let sample;
+</script>
+
+<div class="bg-black text-white rounded-lg p-4 flex gap-4 whitespace-pre-wrap font-mono">
+ <div class="overflow-x-scroll max-w-full scrollbar-hide">
+ <div class="break-all min-w-[800px]">{samples[sample]}</div>
+ </div>
+ <button
+ class="ml-auto my-auto invert opacity-90"
+ on:click={() => copy(samples[sample].replace(/^\s+/gm, '').replace(/\n/g, ''))}
+ ><Icon icon="copy" style="w-10 max-w-none" /></button
+ >
+</div>
+
+<style>
+ .scrollbar-hide::-webkit-scrollbar {
+ display: none;
+ }
+
+ /* For IE, Edge and Firefox */
+ .scrollbar-hide {
+ -ms-overflow-style: none; /* IE and Edge */
+ scrollbar-width: none; /* Firefox */
+ }
+</style>