-
Notifications
You must be signed in to change notification settings - Fork 330
/
Copy pathdemo.astro
72 lines (64 loc) · 1.82 KB
/
demo.astro
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
interface Props {
rawMarkup?: string;
rawScript?: string;
}
import { Tabs, TabItem, Code } from '@astrojs/starlight/components';
import ImageMap from '../../imagemap.astro';
const { rawMarkup, rawScript } = Astro.props;
---
<Tabs>
<TabItem label="Demo">
<ImageMap class:list={['im-map-container']}>
<slot name="map" />
</ImageMap>
<slot name="narrative" />
</TabItem>
{
rawMarkup && (
<TabItem label="HTML">
<Code code={rawMarkup} lang="html" />
</TabItem>
)
}
{
rawScript && (
<TabItem label="Script">
<Code code={rawScript} lang="js" />
</TabItem>
)
}
</Tabs>
<style is:global>
.im-map-container {
--im-border-color: var(--sl-color-text-accent);
width: 75%;
}
.im-map-container img {
display: block;
width: 100%;
height: auto;
}
.expressive-code .frame {
--im-scrollbar-color-thumb: var(--ec-sbThumbCol);
/* expressive code default uses inherit which ultimately uses the pre tag background which is: var(--code-background) which is assigned to var(--ec-frm-edBg); */
--im-scrollbar-color-track: inherit;
}
.expressive-code pre {
overflow: auto !important;
max-height: 500px !important;
}
.expressive-code .copy {
/* Move the "copy-code" button which is absolutely positioned - Using 16px which isn't ideal but avoids javascript and is fairly common */
margin-right: 16px !important;
}
/* FF compatibility - this is becoming the standard https://developer.chrome.com/docs/css-ui/scrollbar-styling */
.expressive-code pre {
scrollbar-color: var(--im-scrollbar-color-thumb)
var(--im-scrollbar-color-track);
}
/* Expressive code uses webkit properties */
.expressive-code pre::-webkit-scrollbar-corner {
background-color: var(--im-scrollbar-color-track);
}
</style>