blob: a5d4bc4ae216aefaab74b0f17d19a0f8dfeabe92 (
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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
---
import { Markdown, Code, Prism } from 'astro/components';
---
<style>
.hidden {
display: none;
}
.active {
background-color: var(--theme-accent);
color: white;
font-weight: bold;
border-top-left-radius: 1em;
border-top-right-radius: 1em;
padding: 3em;
}
.tab-bar {
background-color: var(--theme-divider);
display:flex;
justify-content: flex-start;
margin-bottom:0;
padding: 0.5em;
padding-bottom: 0;
border-top-left-radius: 1em;
border-top-right-radius: 1em;
}
pre {
border-radius: 0;
}
.code {
margin-top:0;
padding-left: 0.5em;
max-width: 100vw;
overflow: hidden;
background-color: hsla(217, 19%, 27%, 1);
}
.toggle {
padding: 0.5em;
padding-left: 1em;
padding-bottom: 0;
cursor: pointer;
width: 20%;
}
</style>
<div class="TabBox">
<div class="tab-bar">
<div id="install-npm" class="active toggle"><h5>npm</h5></div>
<div id="install-yarn" class="toggle"><h5>yarn</h5></div>
</div>
<div id="npm">
<Code lang="bash" code={`# prerequisite: check that Node.js is 14.15.0+, or 16+
node --version
# Make a new project directory, and navigate into it
mkdir my-astro-project && cd $_
# prepare for liftoff...
npm init astro
# install dependencies
npm install
# start developing!
npm run dev`}/ >
</div>
<div id="yarn" class="hidden">
<Code lang="bash" code={`# prerequisite: check that Node.js is 14.15.0+, or 16+
node --version
# Make a new project directory, and navigate into it
mkdir my-astro-project && cd $_
# prepare for liftoff...
yarn create astro
# install dependencies
yarn install
# start developing!
yarn start`}/>
</div>
</div>
<script type="module">
document.getElementById("install-npm").addEventListener("click", () => {
document.getElementById("npm").classList.remove("hidden");
document.getElementById("yarn").classList.add("hidden");
document.getElementById("install-npm").classList.add("active");
document.getElementById("install-yarn").classList.remove("active");
console.log("click");
});
document.getElementById("install-yarn").addEventListener("click", () => {
document.getElementById("yarn").classList.remove("hidden");
document.getElementById("npm").classList.add("hidden");
document.getElementById("install-yarn").classList.add("active");
document.getElementById("install-npm").classList.remove("active");
console.log("click");
});
</script>
|