Organized Rust project in library & binary
This commit is contained in:
parent
3415ce7329
commit
48fdc460ad
22 changed files with 68 additions and 60 deletions
17
web/src/components/SvelteCounter.svelte
Normal file
17
web/src/components/SvelteCounter.svelte
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<script>
|
||||
let count = 0;
|
||||
|
||||
function add() {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
function subtract() {
|
||||
count -= 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="svelte" class="counter">
|
||||
<button on:click={subtract}>-</button>
|
||||
<pre>{ count }</pre>
|
||||
<button on:click={add}>+</button>
|
||||
</div>
|
||||
85
web/src/components/Tour.astro
Normal file
85
web/src/components/Tour.astro
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
---
|
||||
import { Markdown } from 'astro/components';
|
||||
---
|
||||
<article>
|
||||
<div class="banner">
|
||||
<p><strong>🧑🚀 Seasoned astronaut?</strong> Delete this file. Have fun!</p>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<Markdown>
|
||||
## 🚀 Project Structure
|
||||
|
||||
Inside of your Astro project, you'll see the following folders and files:
|
||||
|
||||
```
|
||||
/
|
||||
├── public/
|
||||
│ ├── robots.txt
|
||||
│ └── favicon.ico
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ │ └── Tour.astro
|
||||
│ └── pages/
|
||||
│ └── index.astro
|
||||
└── package.json
|
||||
```
|
||||
|
||||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory.
|
||||
Each page is exposed as a route based on its file name.
|
||||
|
||||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
|
||||
|
||||
Any static assets, like images, can be placed in the `public/` directory.
|
||||
</Markdown>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>👀 Want to learn more?</h2>
|
||||
<p>Feel free to check <a href="https://github.com/snowpackjs/astro">our documentation</a> or jump into our <a href="https://astro.build/chat">Discord server</a>.</p>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
|
||||
<style>
|
||||
article {
|
||||
padding-top: 2em;
|
||||
line-height: 1.5;
|
||||
}
|
||||
section {
|
||||
margin-top: 2em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
max-width: 70ch;
|
||||
}
|
||||
|
||||
.banner {
|
||||
text-align: center;
|
||||
font-size: 1.2rem;
|
||||
background: var(--color-light);
|
||||
padding: 1em 1.5em;
|
||||
padding-left: 0.75em;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
pre,
|
||||
code {
|
||||
font-family: var(--font-mono);
|
||||
background: var(--color-light);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 1em 1.5em;
|
||||
}
|
||||
|
||||
.tree {
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
code:not(.tree) {
|
||||
padding: 0.125em;
|
||||
margin: 0 -0.125em;
|
||||
}
|
||||
</style>
|
||||
7
web/src/layouts/index.astro
Normal file
7
web/src/layouts/index.astro
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>huh</h1>
|
||||
<p>lol</p>
|
||||
<slot />
|
||||
</body>
|
||||
</html>
|
||||
44
web/src/pages/index.astro
Normal file
44
web/src/pages/index.astro
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<html>
|
||||
<body>
|
||||
|
||||
<ul id="nav-bar">
|
||||
<li class="nav-bar-item"><a href="/home">Home</a></li>
|
||||
<li class="nav-bar-item"><a href="/blog">Blog</a></li>
|
||||
<li class="nav-bar-item"><a href="/microblog">Microblog</a></li>
|
||||
<li class="nav-bar-item"><a href="/devlogs">Devlogs</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style>
|
||||
ul#nav-bar {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 200px;
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
|
||||
ul#nav-bar li {
|
||||
text-align: center;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
li.nav-bar-item a {
|
||||
display: block;
|
||||
color: #000;
|
||||
padding: 8px 16px;
|
||||
text-decoration: none;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
|
||||
li.nav-bar-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
li.nav-bar-item a:hover {
|
||||
background-color: #555;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
Reference in a new issue