Start integrating react views

This commit is contained in:
Quentin 2022-03-30 15:49:07 +02:00
parent ee31bc039b
commit fd954bf05b
10 changed files with 51 additions and 15 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ src/*.bs.js
src/**/*.bs.js src/**/*.bs.js
static/**/*.js static/**/*.js
static/*.js static/*.js
static/**/*.js.LICENSE.txt

View file

@ -15,3 +15,13 @@ npx webpack-cli
3. Click on "Load a temporary module" 3. Click on "Load a temporary module"
4. Select Fanzine's `manifest.json` file on your file system 4. Select Fanzine's `manifest.json` file on your file system
5. Click "Refresh" if your modification does not appear automatically 5. Click "Refresh" if your modification does not appear automatically
## Vim plugin
For vim > 8.x
```bash
git clone https://github.com/rescript-lang/vim-rescript ~/.vim/pack/all/start/vim-rescript
```
https://github.com/rescript-lang/vim-rescript

17
package-lock.json generated
View file

@ -1750,6 +1750,15 @@
"object-assign": "^4.1.1" "object-assign": "^4.1.1"
} }
}, },
"react-dom": {
"version": "18.0.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.0.0.tgz",
"integrity": "sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw==",
"requires": {
"loose-envify": "^1.1.0",
"scheduler": "^0.21.0"
}
},
"rechoir": { "rechoir": {
"version": "0.7.1", "version": "0.7.1",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
@ -1797,6 +1806,14 @@
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true "dev": true
}, },
"scheduler": {
"version": "0.21.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz",
"integrity": "sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==",
"requires": {
"loose-envify": "^1.1.0"
}
},
"schema-utils": { "schema-utils": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",

View file

@ -7,7 +7,8 @@
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.58.0", "@aws-sdk/client-s3": "^3.58.0",
"@rescript/react": "^0.10.3", "@rescript/react": "^0.10.3",
"react": "^17.0.2" "react": "^17.0.2",
"react-dom": "^18.0.0"
}, },
"devDependencies": { "devDependencies": {
"rescript": "^9.1.4", "rescript": "^9.1.4",

View file

@ -1,6 +1,4 @@
@react.component @react.component
let make = () => { let make = () => {
<div> <Menu/>
{React.string("Hello ReScripters!")}
</div>
} }

13
src/Menu.res Normal file
View file

@ -0,0 +1,13 @@
@react.component
let make = () => {
<section className="menu">
<div className="menu-title">{ React.string("Publier sur mon espace web")}</div>
<a className="menu-elem" href="#plain-text">{ React.string("Texte brut")}</a>
<div className="menu-elem">{ React.string("Galerie photo")}</div>
<div className="menu-elem">{ React.string("Fichiers")}</div>
<hr/>
<div className="menu-elem">{ React.string("Site statique")}</div>
<hr/>
<div className="menu-elem">{ React.string(`Paramètres`)}</div>
</section>
}

0
src/ShareText.res Normal file
View file

View file

@ -11,14 +11,6 @@ body {
min-width: 300px; min-width: 300px;
} }
/* Navigation logic */
section {
display: none;
}
section:target {
display: block;
}
/* Components definition */ /* Components definition */
a { a {
text-decoration: none; text-decoration: none;

View file

@ -6,10 +6,9 @@
</head> </head>
<body> <body>
<section id="home"> <!-- <section id="home">
<div class="menu-title">Publier sur mon espace web</div> <div class="menu-title">Publier sur mon espace web</div>
<a class="menu-elem" href="#plain-text">Texte brut</a> <a class="menu-elem" href="#plain-text">Texte brut</a>
<!--<div class="menu-elem">Brève</div>-->
<div class="menu-elem">Galerie photo</div> <div class="menu-elem">Galerie photo</div>
<div class="menu-elem">Fichiers</div> <div class="menu-elem">Fichiers</div>
<hr> <hr>
@ -31,8 +30,10 @@
<section id="configure"> <section id="configure">
<div class="menu-title">Paramètres</div> <div class="menu-title">Paramètres</div>
</section> </section>-->
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="fanzine.js"></script> <script src="fanzine.js"></script>
</body> </body>
</html> </html>

View file

@ -7,6 +7,9 @@ export default {
entry: { entry: {
main: "./lib/es6/src/main.bs.js", main: "./lib/es6/src/main.bs.js",
}, },
resolve: {
modules: [path.resolve(__dirname, 'node_modules'), 'node_modules']
},
mode: 'production', mode: 'production',
output: { output: {
filename: "fanzine.js", filename: "fanzine.js",