Adding MPS Export #49

Merged
SinusFox merged 61 commits from adding-unit-tests-and-language-switching into main 2024-10-11 14:08:24 +00:00
4 changed files with 85 additions and 9 deletions
Showing only changes of commit 312e4ae1f5 - Show all commits
+21 -2
View File
@@ -54,8 +54,16 @@ body {
} }
.button { .button {
border: 2px solid #101010; border: 2px solid #5353535c;
background-color: #101010; background-color: #1010105c;
border-radius: 20px;
margin: 10px;
padding: 10px;
}
.button:hover {
border: 2px solid #5353535c;
background-color: #5353535c;
border-radius: 20px; border-radius: 20px;
margin: 10px; margin: 10px;
padding: 10px; padding: 10px;
@@ -139,3 +147,14 @@ body {
font-size: 10; font-size: 10;
height: fit-content 100%; height: fit-content 100%;
} }
.popup_bg {
width: 2000px;
padding: 20px;
box-shadow: 0 2px 10px #7c7c7c;
background: black;
}
.popup-overlay {
background: rgba(0, 0, 0, 0.5);
}
+36 -3
View File
@@ -1,4 +1,5 @@
import { MouseEventHandler } from "react"; import { MouseEventHandler } from "react";
import Popup from "reactjs-popup";
export function Box({title, placeholder, id}: export function Box({title, placeholder, id}:
{title:string; placeholder:string; id:string}) { {title:string; placeholder:string; id:string}) {
@@ -12,7 +13,7 @@ export function Box({title, placeholder, id}:
className="body_box" className="body_box"
id={id} id={id}
wrap="soft" wrap="soft"
required rows={6}
placeholder={placeholder} placeholder={placeholder}
></textarea> ></textarea>
</div> </div>
@@ -21,13 +22,12 @@ export function Box({title, placeholder, id}:
} }
export function Button({title, className, onClickFunc}: export function Button({title, className, onClickFunc}:
{title:string; className:string; onClickFunc: MouseEventHandler}) { {title:string; className:string|undefined; onClickFunc: MouseEventHandler}) {
return( return(
<button <button
className={className} className={className}
onClick={onClickFunc} onClick={onClickFunc}
type="submit"
> >
{title} {title}
</button> </button>
@@ -35,6 +35,39 @@ export function Button({title, className, onClickFunc}:
); );
} }
export function Popup_Button({title, className}:
{title:string; className:string|undefined;}) {
return(
<Popup
trigger={<button
className={className}>
{title}
</button>}
position="right center"
modal
nested>
{close => (
<div className="popup_bg">
<button onClick={close}>
&times;
</button>
<div className="header"> {title} </div>
<div className="content">
This is a popup example.
</div>
<div className="actions">
<button className="button" onClick={close}>
Cancel</button>
</div>
</div>
)}
</Popup>
);
}
export function Output({id, text}: export function Output({id, text}:
{id:string; text:string}) { {id:string; text:string}) {
+14 -3
View File
@@ -1,7 +1,7 @@
'use client' 'use client'
import { Box, Button, Output } from "./modules.tsx"; import { Box, Button, Output, Popup_Button } from "./modules.tsx";
import { test, calculate } from "./scripts.ts" import { calculate_click, import_click, export_click } from "./scripts.ts"
export default function Home() { export default function Home() {
return ( return (
@@ -28,10 +28,21 @@ export default function Home() {
<Button <Button
title={"Calculate"} title={"Calculate"}
className={"button_green"} className={"button_green"}
onClickFunc={calculate} /> onClickFunc={calculate_click} />
<Popup_Button
title={"Import"}
className={"button"} />
<Popup_Button
title={"Export"}
className={"button"} />
<br></br>
<Output <Output
id="out" id="out"
text={"Ergebnis"}/> text={"Ergebnis"}/>
<Popup_Button
title="Popup"
className="button"
/>
</> </>
); );
+14 -1
View File
@@ -2,16 +2,29 @@ export function test() {
console.log("Dies ist die Testfunktion."); console.log("Dies ist die Testfunktion.");
} }
export function calculate() { export function calculate_click() {
console.log("Calculating...");
let functions:string = document.getElementById('funcs').value; let functions:string = document.getElementById('funcs').value;
let variables:string = document.getElementById('vars').value; let variables:string = document.getElementById('vars').value;
let funcs:string[] = functions.split(/; */); let funcs:string[] = functions.split(/; */);
let vars:string[] = variables.split(/; */); let vars:string[] = variables.split(/; */);
// Irgend ein Interface // Irgend ein Interface
// document.getElementById('out').innerHTML = funcs; // document.getElementById('out').innerHTML = funcs;
// output.innerHTML = functions.innerHTML; // output.innerHTML = functions.innerHTML;
} }
export function import_click() {
console.log("Importing...");
}
export function export_click() {
console.log("Exporting...");
}