aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Code.svelte
blob: 00ef38a85550ab65582a6dde070f3c7f1f903358 (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 { copyNoNewlines as copy } from "$lib/utils";
  import Icon from "$comp/Icon.svelte";
  import samples from "$lib/samples";
  let { sample } = $props();
</script>

<div
  class="bg-primary text-primary-content 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"
    onclick={() => copy(samples[sample])}
    ><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>