aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Code.svelte
blob: 0e09191ee21a265b681da33eff2325a18228cb00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<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>