feature: add spring vavr and react
This commit is contained in:
parent
3bc08153a3
commit
7840f8c73e
3
.sdkmanrc
Normal file
3
.sdkmanrc
Normal file
@ -0,0 +1,3 @@
|
||||
# Enable auto-env through the sdkman_auto_env config
|
||||
# Add key=value pairs of SDKs to use below
|
||||
java=21.ea.31-open
|
52
pom.xml
Normal file
52
pom.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</parent>
|
||||
|
||||
<groupId>tk.antoine.roux</groupId>
|
||||
<artifactId>vavr-test</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
|
||||
<vavr.version>1.0.0-alpha-4</vavr.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.vavr</groupId>
|
||||
<artifactId>vavr</artifactId>
|
||||
<version>${vavr.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.vavr</groupId>
|
||||
<artifactId>vavr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
12
src/main/java/tk/antoine/roux/Main.java
Normal file
12
src/main/java/tk/antoine/roux/Main.java
Normal file
@ -0,0 +1,12 @@
|
||||
package tk.antoine.roux;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Main.class, args);
|
||||
}
|
||||
|
||||
}
|
BIN
src/main/resources/public/favicon.ico
Normal file
BIN
src/main/resources/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
18
src/main/resources/public/index.html
Normal file
18
src/main/resources/public/index.html
Normal file
@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>backoffice</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="react_container"></div>
|
||||
|
||||
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
|
||||
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
|
||||
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
|
||||
|
||||
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
||||
|
||||
<!-- Load our React component. -->
|
||||
<script src="http://localhost:35729/livereload.js"></script>
|
||||
<script type="text/babel" src="src/App.js" data-presets="es2015,react"></script>
|
||||
</body>
|
||||
</html>
|
80
src/main/resources/public/src/App.js
Normal file
80
src/main/resources/public/src/App.js
Normal file
@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
// import {useState, useEffect} from 'react';
|
||||
|
||||
function formatDate(date) {
|
||||
return date.toLocaleString();
|
||||
}
|
||||
|
||||
function currentDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
function RootHeader() {
|
||||
return (
|
||||
<header>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function RootFooter() {
|
||||
return (
|
||||
<footer></footer>
|
||||
);
|
||||
}
|
||||
|
||||
function Result({criteria}) {
|
||||
const [res, setRes] = React.useState([]);
|
||||
React.useEffect(() => {
|
||||
console.log("hey")
|
||||
setRes([...res, "toto"]);
|
||||
}, [criteria]);
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
res.map((r) =>
|
||||
<div key={r}>{r}</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function SearchInput() {
|
||||
const [criteria, setCriteria] = React.useState("")
|
||||
// searchByCriteria(criteria);
|
||||
return (
|
||||
<input
|
||||
value={criteria}
|
||||
onChange={e => setCriteria(e.target.value)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function RootBody(props) {
|
||||
return (
|
||||
<div>
|
||||
<div>coucou 2</div>
|
||||
<SearchInput/>
|
||||
<Result/>
|
||||
<div>{formatDate(props.date)}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div>
|
||||
<RootHeader/>
|
||||
<RootBody date={currentDate()}/>
|
||||
<RootFooter/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
let target = ReactDOM.createRoot(document.getElementById('react_container'));
|
||||
target.render(
|
||||
<React.StrictMode>
|
||||
<App/>
|
||||
</React.StrictMode>
|
||||
)
|
Loading…
Reference in New Issue
Block a user