aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Code.svelte
blob: a718c5ed8e7a61d9153444cb9f54422a28fb3497 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { colo
<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>