File size: 914 Bytes
a03b3ba |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
<script lang="ts">
import CopyButton from "./CopyButton.svelte";
import { Block } from "@gradio/atoms";
export let current_language: "python" | "javascript";
let py_install = "pip install gradio_client";
let js_install = "npm i -D @gradio/client";
</script>
<Block>
<code>
{#if current_language === "python"}
<div class="copy">
<CopyButton code={py_install} />
</div>
<div>
<pre>$ {py_install}</pre>
</div>
{:else if current_language === "javascript"}
<div class="copy">
<CopyButton code={js_install} />
</div>
<div>
<pre>$ {js_install}</pre>
</div>
{/if}
</code>
</Block>
<style>
code pre {
overflow-x: auto;
color: var(--body-text-color);
font-family: var(--font-mono);
tab-size: 2;
}
code {
position: relative;
display: block;
}
.copy {
position: absolute;
top: 0;
right: 0;
margin-top: -5px;
margin-right: -5px;
}
</style>
|