commit
b769a43d46
@ -1,23 +0,0 @@ |
|||||||
{ |
|
||||||
"files": [ |
|
||||||
"README.md" |
|
||||||
], |
|
||||||
"imageSize": 100, |
|
||||||
"commit": false, |
|
||||||
"contributors": [ |
|
||||||
{ |
|
||||||
"login": "pepf", |
|
||||||
"name": "Pepijn", |
|
||||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1265435?v=4", |
|
||||||
"profile": "http://blog.pepf.nl", |
|
||||||
"contributions": [ |
|
||||||
"code" |
|
||||||
] |
|
||||||
} |
|
||||||
], |
|
||||||
"contributorsPerLine": 7, |
|
||||||
"projectName": "react-nodegui-starter", |
|
||||||
"projectOwner": "nodegui", |
|
||||||
"repoType": "github", |
|
||||||
"repoHost": "https://github.com" |
|
||||||
} |
|
@ -0,0 +1,8 @@ |
|||||||
|
{ |
||||||
|
"presets": [ |
||||||
|
["@babel/preset-env", { "targets": { "node": "12" } }], |
||||||
|
"@babel/preset-typescript", |
||||||
|
"@babel/preset-react" |
||||||
|
], |
||||||
|
"plugins": [] |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
declare module "*.svg"; |
||||||
|
declare module "*.png"; |
||||||
|
declare module "*.jpg"; |
||||||
|
declare module "*.jpeg"; |
||||||
|
declare module "*.gif"; |
||||||
|
declare module "*.bmp"; |
After Width: | Height: | Size: 163 KiB |
@ -1 +0,0 @@ |
|||||||
declare module "*.jpg"; |
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,50 @@ |
|||||||
|
import { Text, Window, hot, View } from "@nodegui/react-nodegui"; |
||||||
|
import React from "react"; |
||||||
|
import { QIcon } from "@nodegui/nodegui"; |
||||||
|
import path from "path"; |
||||||
|
import { StepOne } from "./components/stepone"; |
||||||
|
import { StepTwo } from "./components/steptwo"; |
||||||
|
import nodeguiIcon from "../assets/nodegui.jpg"; |
||||||
|
|
||||||
|
const minSize = { width: 500, height: 520 }; |
||||||
|
const winIcon = new QIcon(path.resolve(__dirname, nodeguiIcon)); |
||||||
|
class App extends React.Component { |
||||||
|
render() { |
||||||
|
return ( |
||||||
|
<Window |
||||||
|
windowIcon={winIcon} |
||||||
|
windowTitle="Hello 👋🏽" |
||||||
|
minSize={minSize} |
||||||
|
styleSheet={styleSheet} |
||||||
|
> |
||||||
|
<View style={containerStyle}> |
||||||
|
<Text id="welcome-text">Welcome to NodeGui 🐕</Text> |
||||||
|
<Text id="step-1">1. Play around</Text> |
||||||
|
<StepOne /> |
||||||
|
<Text id="step-2">2. Debug</Text> |
||||||
|
<StepTwo /> |
||||||
|
</View> |
||||||
|
</Window> |
||||||
|
); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
const containerStyle = ` |
||||||
|
flex: 1;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const styleSheet = ` |
||||||
|
#welcome-text { |
||||||
|
font-size: 24px; |
||||||
|
padding-top: 20px; |
||||||
|
qproperty-alignment: 'AlignHCenter'; |
||||||
|
} |
||||||
|
|
||||||
|
#step-1, #step-2 { |
||||||
|
font-size: 18px; |
||||||
|
padding-top: 10px; |
||||||
|
padding-horizontal: 20px; |
||||||
|
} |
||||||
|
`;
|
||||||
|
|
||||||
|
export default hot(App); |
@ -0,0 +1,30 @@ |
|||||||
|
module.exports = `data:image/png;base64,
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAADIAAAAzCAMAAADivasmAAACglBMVEUAAABPPz9RQj9QQUBPPj5PPz5TRENQQEBTQUFRQUFRQUFTQ0J |
||||||
|
RQUFQQEBkWFdXSkpVSUhTQEFRQUFUQUFQQUBQQEBOPj1QQD9WQkVdUE5RRERZTEtWRkdRQUFQQEBQQEBSQUJRQUFRQEBURUVQQEBPPT |
||||||
|
1aRUVOPT1VRkZPQUBRQEBRQUBSQUFPQEBTQUFSQ0NRQEFQQkFUPkFUQkNOPz5RPj9SP0BTRERVRUVUQEFWRUX///+jnpz+//6lnpykn
|
||||||
|
pz9/f2inpyinZv9/v2kn538+/v///6inpv7+vmknZv+/v/+/f22s7KnoJ6X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mQEmoZ1LJVIwli1 |
||||||
|
LhyLaofbVGalMs0DzZLJmuiPceSnF5dt9/Z47QQBhHxY1f5YZMFvAUQjf9Gmpy2cLhmV/3jcN0T+6+BpMEznEyYWkQegpKKpTucO8m/ |
||||||
|
JptisAEcDUs/+vPh+wf77n/bl9jq2B/CcxSm9D1zNhJO4eSMenBK40ji8NFDLxK+7HvZcUcXo3Q6OhKC0rELvH8T59exVKRrcCca7if |
||||||
|
svbyv48Ir3Vm1YyaWIhHkziG8FVSm5QF/JCUZp45uwciFvXdkhKalfLSU+PZZU72RwM4SlK0q9mQjbrMLuRtVgBITDhoYgJCw+g3eyN |
||||||
|
QVlUZeXjMt0SkpV3683nvoQcfeT1HREWlnYkXAMCqqc8IU4g/5jazOptALQn1Rnb8d9bEjISHh7tKqViMAPH6N2b0TdxJ/a/J4M4WjE |
||||||
|
DJ8r/3hu0Nfn9S2Q4AlZnWNn+zrb9QG/xlmG3p3AIr6rrqkpPrcLIik0trMM/ynEb4V7D++qow1AkYE2uw4VssyjJEtq5q9cjQxtKaP |
||||||
|
mjuzurIiLM5GUWxcWEVlzcx5k6YS/5HforX+iUkNDQ32zUH+q9dN/+fAbySYWHnCNGc5AAAAAElFTkSuQmCC`;
|
@ -0,0 +1,30 @@ |
|||||||
|
import { Text, View } from "@nodegui/react-nodegui"; |
||||||
|
import React from "react"; |
||||||
|
const dogImg = require("./dog"); |
||||||
|
|
||||||
|
export function StepOne() { |
||||||
|
return ( |
||||||
|
<View style={containerStyle}> |
||||||
|
<Text wordWrap={true}> |
||||||
|
Edit App.tsx to make changes to this screen. Then come back to see your |
||||||
|
changes. Changes should reflect live thanks to Hot Reloading. 🔥 |
||||||
|
</Text> |
||||||
|
<Text> |
||||||
|
{` |
||||||
|
<p style="color: rgb(255,72,38);">
|
||||||
|
<center> |
||||||
|
<img src="${dogImg}" alt="doggy" />
|
||||||
|
</center> |
||||||
|
<center>You can even use <i><strong>Rich Html</strong></i> text like this if you want 😎.</center> |
||||||
|
</p> |
||||||
|
<hr /> |
||||||
|
`}
|
||||||
|
</Text> |
||||||
|
</View> |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
const containerStyle = ` |
||||||
|
margin-horizontal: 20px; |
||||||
|
padding-horizontal: 10px; |
||||||
|
`;
|
@ -0,0 +1,48 @@ |
|||||||
|
import { Text, View, Button } from "@nodegui/react-nodegui"; |
||||||
|
import { QPushButtonEvents } from "@nodegui/nodegui"; |
||||||
|
import React from "react"; |
||||||
|
import open from "open"; |
||||||
|
|
||||||
|
const buttonEventHandler = { |
||||||
|
[QPushButtonEvents.clicked]: () => { |
||||||
|
open("https://react.nodegui.org").catch(console.log); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export function StepTwo() { |
||||||
|
return ( |
||||||
|
<View> |
||||||
|
<Text style={textStyle} wordWrap={true}> |
||||||
|
{` |
||||||
|
<ol> |
||||||
|
<li> |
||||||
|
Open chrome and navigate to <code>chrome://inspect</code>. You should see a target below with your app.
|
||||||
|
</li> |
||||||
|
<br/> |
||||||
|
<li> |
||||||
|
Next click on "<code>Open dedicated DevTools for Node</code>" |
||||||
|
</li> |
||||||
|
<br/> |
||||||
|
<li> |
||||||
|
On the dedicated devtools. Click on <code> Source > Node > "Your node process" </code> |
||||||
|
</li> |
||||||
|
</ol> |
||||||
|
`}
|
||||||
|
</Text> |
||||||
|
<Button |
||||||
|
style={btnStyle} |
||||||
|
on={buttonEventHandler} |
||||||
|
text={`Open React NodeGui docs`} |
||||||
|
></Button> |
||||||
|
</View> |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
const textStyle = ` |
||||||
|
padding-right: 20px; |
||||||
|
`;
|
||||||
|
|
||||||
|
const btnStyle = ` |
||||||
|
margin-horizontal: 20px; |
||||||
|
height: 40px; |
||||||
|
`;
|
@ -1,56 +1,12 @@ |
|||||||
import { |
import { Renderer } from "@nodegui/react-nodegui"; |
||||||
Renderer, |
|
||||||
View, |
|
||||||
Text, |
|
||||||
Window, |
|
||||||
Image, |
|
||||||
ScrollArea |
|
||||||
} from "@nodegui/react-nodegui"; |
|
||||||
import path from "path"; |
|
||||||
import React from "react"; |
import React from "react"; |
||||||
import { AspectRatioMode } from "@nodegui/nodegui"; |
import App from "./app"; |
||||||
|
|
||||||
import imageUrl from "../assets/nodegui.jpg"; |
|
||||||
const distImgUrl = path.resolve(__dirname, imageUrl); |
|
||||||
const minSize = { width: 500, height: 400 }; |
|
||||||
|
|
||||||
const App = () => { |
|
||||||
return ( |
|
||||||
<Window minSize={minSize} styleSheet={styleSheet}> |
|
||||||
<ScrollArea style={`height: '100%';width: '100%';`}> |
|
||||||
<View id="container"> |
|
||||||
<Text style="font-size: 15px; font-weight: bold; margin-bottom: 20px;"> |
|
||||||
Hello World |
|
||||||
</Text> |
|
||||||
<Image |
|
||||||
style={imageStyle} |
|
||||||
src={distImgUrl} |
|
||||||
aspectRatioMode={AspectRatioMode.KeepAspectRatio} |
|
||||||
/> |
|
||||||
</View> |
|
||||||
</ScrollArea> |
|
||||||
</Window> |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
const imageStyle = ` |
|
||||||
height: "700px"; |
|
||||||
width: "700px"; |
|
||||||
qproperty-alignment: 'AlignHCenter'; |
|
||||||
`;
|
|
||||||
|
|
||||||
const styleSheet = ` |
|
||||||
#container { |
|
||||||
flex: 1; |
|
||||||
min-height: 0; |
|
||||||
min-width: 0; |
|
||||||
width: '900'; |
|
||||||
height: '900'; |
|
||||||
flex-direction: column; |
|
||||||
align-items: 'center'; |
|
||||||
justify-content: 'center'; |
|
||||||
background-color: 'grey'; |
|
||||||
} |
|
||||||
`;
|
|
||||||
|
|
||||||
|
process.title = "My NodeGui App"; |
||||||
Renderer.render(<App />); |
Renderer.render(<App />); |
||||||
|
// This is for hot reloading (this will be stripped off in production by webpack)
|
||||||
|
if (module.hot) { |
||||||
|
module.hot.accept(["./app"], function() { |
||||||
|
Renderer.forceUpdate(); |
||||||
|
}); |
||||||
|
} |
||||||
|
@ -1,34 +1,58 @@ |
|||||||
const path = require("path"); |
const path = require("path"); |
||||||
|
const webpack = require("webpack"); |
||||||
|
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); |
||||||
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin"); |
||||||
|
|
||||||
module.exports = { |
module.exports = (env, argv) => { |
||||||
mode: process.NODE_ENV || "development", |
const config = { |
||||||
entry: "./src", |
mode: "production", |
||||||
target: "node", |
entry: ["./src/index.tsx"], |
||||||
output: { |
target: "node", |
||||||
path: path.resolve(__dirname, "dist"), |
output: { |
||||||
filename: "index.js" |
path: path.resolve(__dirname, "dist"), |
||||||
}, |
filename: "index.js" |
||||||
node: { |
}, |
||||||
__dirname: false |
node: { |
||||||
}, |
__dirname: false, |
||||||
module: { |
__filename: false |
||||||
rules: [ |
}, |
||||||
{ |
module: { |
||||||
test: /\.tsx?$/, |
rules: [ |
||||||
use: "ts-loader", |
{ |
||||||
exclude: /node_modules/ |
test: /\.(j|t)sx?$/, |
||||||
}, |
exclude: /node_modules/, |
||||||
{ |
use: { |
||||||
test: /\.(png|jpe?g|gif|svg)$/i, |
loader: "babel-loader", |
||||||
use: [{ loader: "file-loader" }] |
options: { cacheDirectory: true, cacheCompression: false } |
||||||
}, |
} |
||||||
{ |
}, |
||||||
test: /\.node/i, |
{ |
||||||
use: [{ loader: "node-loader" }, { loader: "file-loader" }] |
test: /\.(png|jpe?g|gif|svg|bmp)$/i, |
||||||
} |
use: [{ loader: "file-loader" }] |
||||||
] |
}, |
||||||
}, |
{ |
||||||
resolve: { |
test: /\.node/i, |
||||||
extensions: [".tsx", ".ts", ".js"] |
use: [{ loader: "node-loader" }, { loader: "file-loader" }] |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
plugins: [], |
||||||
|
resolve: { |
||||||
|
extensions: [".tsx", ".ts", ".js", ".jsx", ".json"] |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
if (argv.mode === "development") { |
||||||
|
config.mode = "development"; |
||||||
|
config.plugins.push(new webpack.HotModuleReplacementPlugin()); |
||||||
|
config.plugins.push(new ForkTsCheckerWebpackPlugin()); |
||||||
|
config.devtool = "source-map"; |
||||||
|
config.watch = true; |
||||||
|
config.entry.unshift("webpack/hot/poll?100"); |
||||||
|
} |
||||||
|
|
||||||
|
if (argv.p) { |
||||||
|
config.plugins.push(new CleanWebpackPlugin()); |
||||||
} |
} |
||||||
|
return config; |
||||||
}; |
}; |
||||||
|
Loading…
Reference in new issue