feat: initialize Tauri application with Preact framework
- Added main application logic in `src-tauri/src/lib.rs` and `src-tauri/src/main.rs`. - Configured Tauri settings in `tauri.conf.json`. - Created basic styling in `src/App.css`. - Implemented main application component in `src/App.tsx` with greeting functionality. - Included Preact logo in `src/assets/preact.svg`. - Set up rendering in `src/main.tsx`. - Defined TypeScript environment in `vite-env.d.ts` and configured TypeScript settings in `tsconfig.json` and `tsconfig.node.json`. - Configured Vite for Tauri development in `vite.config.ts`.
This commit is contained in:
1 parent
08e154894a
commit
a2a512d41d
9 files changed
+146
-1
No files matched your search
@@ -1,5 +1,8 @@
|
||||
<<<<<<< HEAD
|
||||
@import "tailwindcss";
|
||||
|
||||
=======
|
||||
>>>>>>> ce33464 (feat: initialize Tauri application with Preact framework)
|
||||
.logo.vite:hover {
|
||||
filter: drop-shadow(0 0 2em #747bff);
|
||||
}
|
||||
|
||||
+55
-1
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
import "@fontsource/inter";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import {
|
||||
@@ -293,4 +294,57 @@ export default function App() {
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
=======
|
||||
import { useState } from "preact/hooks";
|
||||
import preactLogo from "./assets/preact.svg";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import "./App.css";
|
||||
|
||||
function App() {
|
||||
const [greetMsg, setGreetMsg] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
|
||||
async function greet() {
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
setGreetMsg(await invoke("greet", { name }));
|
||||
}
|
||||
|
||||
return (
|
||||
<main class="container">
|
||||
<h1>Welcome to Tauri + Preact</h1>
|
||||
|
||||
<div class="row">
|
||||
<a href="https://vite.dev" target="_blank">
|
||||
<img src="/vite.svg" class="logo vite" alt="Vite logo" />
|
||||
</a>
|
||||
<a href="https://tauri.app" target="_blank">
|
||||
<img src="/tauri.svg" class="logo tauri" alt="Tauri logo" />
|
||||
</a>
|
||||
<a href="https://preactjs.com" target="_blank">
|
||||
<img src={preactLogo} class="logo preact" alt="Preact logo" />
|
||||
</a>
|
||||
</div>
|
||||
<p>Click on the Tauri, Vite, and Preact logos to learn more.</p>
|
||||
|
||||
<form
|
||||
class="row"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
greet();
|
||||
}}
|
||||
>
|
||||
<input
|
||||
id="greet-input"
|
||||
onInput={(e) => setName(e.currentTarget.value)}
|
||||
placeholder="Enter a name..."
|
||||
/>
|
||||
<button type="submit">Greet</button>
|
||||
</form>
|
||||
<p>{greetMsg}</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
>>>>>>> ce33464 (feat: initialize Tauri application with Preact framework)
|
||||
@@ -1,5 +1,8 @@
|
||||
import { render } from "preact";
|
||||
<<<<<<< HEAD
|
||||
import "./App.css";
|
||||
=======
|
||||
>>>>>>> ce33464 (feat: initialize Tauri application with Preact framework)
|
||||
import App from "./App";
|
||||
|
||||
render(<App />, document.getElementById("root")!);
|
||||
Reference in new issue
Block a user