Updated starter to hello world

master
Kakul Gupta 5 years ago
parent dca5a78d0a
commit 3729533f65
  1. BIN
      assets/nodegui.jpg
  2. BIN
      assets/sample.jpg
  3. 12
      package-lock.json
  4. 34
      src/index.tsx

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

12
package-lock.json generated

@ -3039,9 +3039,9 @@
"dev": true
},
"is-retry-allowed": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz",
"integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz",
"integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==",
"dev": true
},
"is-stream": {
@ -3598,9 +3598,9 @@
"dev": true
},
"nodemon": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.19.1.tgz",
"integrity": "sha512-/DXLzd/GhiaDXXbGId5BzxP1GlsqtMGM9zTmkWrgXtSqjKmGSbLicM/oAy4FR0YWm14jCHRwnR31AHS2dYFHrg==",
"version": "1.19.2",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.19.2.tgz",
"integrity": "sha512-hRLYaw5Ihyw9zK7NF+9EUzVyS6Cvgc14yh8CAYr38tPxJa6UrOxwAQ351GwrgoanHCF0FalQFn6w5eoX/LGdJw==",
"dev": true,
"requires": {
"chokidar": "^2.1.5",

@ -2,31 +2,22 @@ import {
Renderer,
View,
Text,
Button,
Window,
Image,
useEventHandler
} from "@nodegui/react-nodegui";
import path from "path";
import React, { useState } from "react";
import { AspectRatioMode, QPushButtonEvents } from "@nodegui/nodegui";
import React from "react";
import { AspectRatioMode } from "@nodegui/nodegui";
import imageUrl from "../assets/sample.jpg";
import imageUrl from "../assets/nodegui.jpg";
const distImgUrl = path.resolve(__dirname, imageUrl);
const minSize = {width: 500, height: 400};
const fixedSize = { width: 500, height: 500 };
const App = () => {
const [time, setTime] = useState(new Date());
const btnHandler = useEventHandler(
{ [QPushButtonEvents.clicked]: () => setTime(new Date()) },
[]
);
return (
<Window minSize={fixedSize} maxSize={fixedSize} styleSheet={styleSheet}>
<Window minSize={minSize} styleSheet={styleSheet}>
<View id="container">
<Button text="Update Time" on={btnHandler} />
<Text id="result">{`${time}`}</Text>
<Text id="result">{`Time in epoc: ${time.getTime()}`}</Text>
<Text style="font-size: 15px; font-weight: bold; margin-bottom: 20px;">Hello World</Text>
<Image
style={imageStyle}
src={distImgUrl}
@ -38,7 +29,9 @@ const App = () => {
};
const imageStyle = `
height: "70%";
height: "100px";
width: "100px";
qproperty-alignment: 'AlignHCenter';
`;
const styleSheet = `
@ -48,15 +41,6 @@ const styleSheet = `
min-height: '100%';
align-items: 'center';
justify-content: 'center';
background-color: black;
}
#opBtn {
font-size: 20px;
}
#result {
font-size: 12px;
flex: 1;
color: cyan;
}
`;

Loading…
Cancel
Save