You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Translation/src/index.tsx

42 lines
973 B

import { Renderer, View, Text, Button, Window } from "@nodegui/react-desktop";
import React, { useState, useMemo } from "react";
import { QPushButtonEvents } from "@nodegui/nodegui";
const App = () => {
const [time, setTime] = useState(`${new Date()}`);
const buttonEventHandlers = useMemo(
() => ({
[QPushButtonEvents.clicked]: () => setTime(`${new Date()}`)
}),
[]
);
return (
<Window styleSheet={styleSheet}>
<View id="container">
<Button text="Update Time" on={buttonEventHandlers} />
<Text id="result">{time}</Text>
</View>
</Window>
);
};
const styleSheet = `
#container {
qproperty-flex: 1;
qproperty-flexDirection: column;
qproperty-minHeight: '100%';
qproperty-alignItems: 'center';
qproperty-justifyContent: 'center';
}
#opBtn {
font-size: 20px;
}
#result {
font-size: 12px;
qproperty-flex: 1;
color: cyan;
}
`;
Renderer.render(<App />, () => {});