Skip to content

Commit 69057d9

Browse files
committed
Add file download component
1 parent af886be commit 69057d9

9 files changed

Lines changed: 131 additions & 34 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ export default defineConfig({
6565
{ text: "Home", link: "/" },
6666
{ text: "Informatique", link: "/Info/" },
6767
{ text: "Mecanique", link: "/Meca/" },
68-
{ text: "Contribuer", link: "/Contribuer/" },
68+
{ text: "Contribuer", link: "/Contribuer" },
6969
],
7070

7171
sidebar: {
7272
"/Info/": [
73+
{
74+
text: "Introduction",
75+
link: "/Info/",
76+
},
7377
{
7478
text: "Divers",
7579
collapsed: false,
@@ -90,7 +94,7 @@ export default defineConfig({
9094
},
9195
{
9296
text: "Build avec CMake",
93-
collapsed: true,
97+
collapsed: false,
9498
items: [
9599
{ text: "Installer CMake", link: "/Info/CMake/Installation" },
96100
{ text: "Créer un éxecutable", link: "/Info/CMake/Executable" },
@@ -100,7 +104,7 @@ export default defineConfig({
100104
},
101105
{
102106
text: "Projets STM32",
103-
collapsed: true,
107+
collapsed: false,
104108
items: [
105109
{ text: "Installer", link: "/Info/STM32/Installation" },
106110
{ text: "Créer un projet", link: "/Info/STM32/Projet" },
@@ -109,14 +113,14 @@ export default defineConfig({
109113
},
110114
{
111115
text: "Bus CAN",
112-
collapsed: true,
116+
collapsed: false,
113117
items: [
114118
{ text: "Principe", link: "/Info/CAN/Principe" },
115119
{ text: "Librairie Raspberry", link: "/Info/CAN/Raspberry" },
116120
{ text: "Librairie STM32", link: "/Info/CAN/STM32" },
117121
{
118122
text: "Implémentation",
119-
collapsed: false,
123+
collapsed: true,
120124
items: [
121125
{
122126
text: "Format des trames",
@@ -140,13 +144,13 @@ export default defineConfig({
140144
},
141145
{
142146
text: "Modules XBee",
143-
collapsed: true,
147+
collapsed: false,
144148
items: [
145149
{ text: "Principe", link: "/Info/XBee/Principe" },
146150
{ text: "Utiliser la librairie", link: "/Info/XBee/Librairie" },
147151
{
148152
text: "Implémentation",
149-
collapsed: false,
153+
collapsed: true,
150154
items: [
151155
{
152156
text: "Format des trames",
@@ -170,15 +174,15 @@ export default defineConfig({
170174
},
171175
{
172176
text: "Odométrie",
173-
collapsed: true,
177+
collapsed: false,
174178
items: [
175179
{
176180
text: "Présentation Odométrie",
177181
link: "/Info/Odometrie/PresentationOdometrie",
178182
},
179183
{
180184
text: "Odométrie Absolue",
181-
collapsed: false,
185+
collapsed: true,
182186
items: [
183187
{
184188
text: "Présentation générale",
@@ -216,7 +220,7 @@ export default defineConfig({
216220
},
217221
{
218222
text: "Odométrie Relative",
219-
collapsed: false,
223+
collapsed: true,
220224
items: [
221225
{
222226
text: "Capteur optique",
@@ -229,12 +233,12 @@ export default defineConfig({
229233
},
230234
{
231235
text: "Signaux PWM",
232-
collapsed: true,
236+
collapsed: false,
233237
items: [
234238
{ text: "STM32", link: "/Info/PWM/STM32" },
235239
{
236240
text: "PCA9685",
237-
collapsed: false,
241+
collapsed: true,
238242
items: [
239243
{
240244
text: "Utiliser la librairie",
@@ -250,31 +254,44 @@ export default defineConfig({
250254
},
251255
],
252256
"/Meca/": [
253-
{ text: "Outils", link: "/Meca/Outils" },
254-
{ text: "Exports Fusion360", link: "/Meca/Exports" },
257+
{ text: "Introduction", link: "/Meca/" },
255258
{
256-
text: "Fusion360",
259+
text: "Divers",
260+
collapsed: false,
257261
items: [
258-
{ text: "Préparation dans Fusion360", link: "/Meca/Usinage/SetupFusion360" },
259-
]
262+
{ text: "Outils", link: "/Meca/Outils" },
263+
{ text: "Exports Fusion360", link: "/Meca/Exports" },
264+
],
265+
},
266+
{
267+
text: "Fusion360",
268+
collapsed: false,
269+
items: [{ text: "Bonnes pratiques", link: "/Meca/BonnesPratiques" }],
260270
},
261271
{
262272
text: "Usinage",
273+
collapsed: false,
263274
items: [
264-
{ text: "Préparation dans Fusion360", link: "/Meca/Usinage/SetupFusion360" },
275+
{
276+
text: "Préparation dans Fusion360",
277+
link: "/Meca/Usinage/SetupFusion360",
278+
},
279+
{ text: "Installation Candle", link: "/Meca/Usinage/SetupCandle" },
265280
{ text: "Setup ProverXL 4030", link: "/Meca/Usinage/SetupCNC" },
266281
{ text: "Traitement usinage 2D", link: "/Meca/Usinage/Usinage2D" },
267282
{ text: "Traitement usinage 3D", link: "/Meca/Usinage/Usinage3D" },
268-
]
283+
],
269284
},
270285
{
271286
text: "Impression 3D",
287+
collapsed: false,
272288
items: [
273-
{ text: "Préparation dans Fusion360", link: "/Meca/Impression3D/SetupFusion360" },
274-
{ text: "Setup ProverXL 4030", link: "/Meca/Impression3D/SetupCNC" },
275-
{ text: "Traitement usinage 2D", link: "/Meca/Impression3D/Usinage2D" },
276-
{ text: "Traitement usinage 3D", link: "/Meca/Impression3D/Usinage3D" },
277-
]
289+
{
290+
text: "Préparation dans Fusion360",
291+
link: "/Meca/Impression3D/SetupFusion360",
292+
},
293+
{ text: "Slicer", link: "/Meca/Impression3D/Slicer" },
294+
],
278295
},
279296
],
280297
},
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<script setup>
2+
const props = defineProps(["path"]);
3+
4+
let path = props.path;
5+
const fileName = path.match(/.*\/(.*)/)[1];
6+
7+
function downloadURI(uri, name) {
8+
var link = document.createElement("a");
9+
link.download = name;
10+
link.href = uri;
11+
document.body.appendChild(link);
12+
link.click();
13+
document.body.removeChild(link);
14+
link.remove();
15+
}
16+
</script>
17+
18+
<template>
19+
<button class="file-container" @click="downloadURI(path, fileName)">
20+
<div class="flex">
21+
<slot></slot>
22+
<p>{{ path }}</p>
23+
</div>
24+
<span class="download-icon"></span>
25+
</button>
26+
</template>
27+
28+
<style scoped>
29+
.file-container {
30+
display: flex;
31+
padding: 20px;
32+
margin: 15px 0;
33+
color: var(--vp-c-brand-1);
34+
font-size: large;
35+
border: 1px solid var(--vp-c-divider);
36+
border-radius: 8px;
37+
transition: border-color 0.25s;
38+
cursor: pointer;
39+
width: 100%;
40+
text-decoration: unset;
41+
42+
text-align: left;
43+
font-weight: 500;
44+
45+
justify-content: space-between;
46+
47+
&:hover {
48+
border-color: var(--vp-c-brand-1);
49+
}
50+
}
51+
52+
p {
53+
margin: 0;
54+
font-size: small;
55+
color: var(--vp-c-text-2);
56+
}
57+
58+
.download-icon {
59+
mask: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Uploaded to: SVG Repo www.svgrepo.com Generator: SVG Repo Mixer Tools --%3E%3Csvg width='800px' height='800px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 15C3 17.8284 3 19.2426 3.87868 20.1213C4.75736 21 6.17157 21 9 21H15C17.8284 21 19.2426 21 20.1213 20.1213C21 19.2426 21 17.8284 21 15' stroke='%231C274C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 3V16M12 16L16 11.625M12 16L8 11.625' stroke='%231C274C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")no-repeat;
60+
height: 24px;
61+
width: 24px;
62+
display: block;
63+
fill: currentColor;
64+
box-sizing: border-box;
65+
color: inherit;
66+
background-color: var(--vp-c-text-2);
67+
mask-size: 100% 100%;
68+
}
69+
</style>

docs/.vitepress/theme/index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import type { Theme } from 'vitepress'
1+
import type { Theme } from "vitepress";
22
import DefaultTheme from "vitepress/theme";
3-
import "./custom.css"
3+
import "./custom.css";
44

5-
import ZoomLayout from './ZoomLayout.vue';
5+
import ZoomLayout from "./ZoomLayout.vue";
6+
import FileComponent from "./FileComponent.vue";
67

78
export default {
8-
extends: DefaultTheme,
9-
Layout: ZoomLayout
10-
} satisfies Theme
9+
extends: DefaultTheme,
10+
Layout: ZoomLayout,
11+
enhanceApp({ app }) {
12+
app.component("file", FileComponent);
13+
},
14+
} satisfies Theme;

docs/Info/CMake/Executable.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description: Comment créer un exécutable avec CMake
66
# Créer un exécutable
77

88
Pour créer un exécutable avec CMake, il faut créer un fichier `CMakeLists.txt` à la racine du projet. Ce fichier contient les instructions pour créer un exécutable à partir des fichiers sources :
9+
910
```cmake
1011
cmake_minimum_required(VERSION 3.x) # Version de cmake
1112
set(CMAKE_CXX_STANDARD 20) # Version de C++ (11, 14, 17, 20, 23)
@@ -15,6 +16,7 @@ add_executable(${PROJECT_NAME} main.cpp) # Créer un exécutable du même nom q
1516
```
1617

1718
Pour compiler le projet, il faut créer un dossier où seront stockés les fichiers de compilation :
19+
1820
```bash
1921
mkdir build && cd build
2022

@@ -31,11 +33,14 @@ make # Compile le projet
3133
Optionnellement, pour les fichiers source, il est possible d'éviter les chemins relatifs pour inclure les headers :
3234

3335
- Dans le fichier `CMakeLists.txt` :
36+
3437
```cmake
3538
# Avant add_executable
3639
include_directories(dossier1 dossier2 ...)
3740
```
41+
3842
- Dans les fichiers source et headers :
43+
3944
```cpp
4045
#include <header.h> // au lieu de ../dossier1/header.h par exemple
4146
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Usinage3D
1+
# BonnesPratiques
22

33
<!-- TODO: Add content for this page -->
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SetupCNC
1+
# Slicer
22

33
<!-- TODO: Add content for this page -->
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Usinage2D
1+
# SetupCandle
22

33
<!-- TODO: Add content for this page -->
44

docs/Meca/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# Mécanique
1+
# Mécanique
2+
3+
<file path="/Wiki/Genmitsu_ProveXL_4030_userCommands.uc">Profile</file>
File renamed without changes.

0 commit comments

Comments
 (0)