1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-19 13:27:58 +00:00
rolens/frontend/src/components/code-example.svelte

34 lines
550 B
Svelte
Raw Normal View History

2023-01-10 16:28:27 +00:00
<script>
2023-01-15 11:09:27 +00:00
import CodeViewer from './codeviewer.svelte';
2023-01-10 16:28:27 +00:00
export let code = '';
2023-01-15 11:09:27 +00:00
let modalCode = '';
2023-01-10 16:28:27 +00:00
</script>
2023-01-15 11:09:27 +00:00
<div class="examplecode" on:pointerdown={() => modalCode = code}>
2023-01-10 16:28:27 +00:00
<strong>CLI command</strong>
<code>{code}</code>
</div>
2023-01-15 11:09:27 +00:00
<CodeViewer bind:code={modalCode} language="js" />
2023-01-10 16:28:27 +00:00
<style>
.examplecode {
border: 1px solid #ccc;
border-radius: 10px;
padding: 0.5rem;
opacity: 0.6;
}
strong {
display: inline-block;
margin-right: 1rem;
font-weight: 700;
}
code {
user-select: all;
}
</style>