-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 initialize gui #11
base: main
Are you sure you want to change the base?
2 initialize gui #11
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,20 @@ | ||
import { useState } from "react"; | ||
import reactLogo from "./assets/react.svg"; | ||
import viteLogo from "/vite.svg"; | ||
import "./App.css"; | ||
import React from 'react'; | ||
import Navbar from './components/Navbar/Navbar'; | ||
import StatusIndicator from './components/StatusIndicator/StatusIndicator'; | ||
import ControlPanel from './components/ControlPanel/ControlPanel'; | ||
import './App.css'; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0); | ||
|
||
return ( | ||
<> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}> | ||
count is {count} | ||
</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs"> | ||
Click on the Vite and React logos to learn more | ||
</p> | ||
</> | ||
<div className="App"> | ||
<Navbar /> | ||
<StatusIndicator status="green" /> | ||
<main className="content"> | ||
{"HX10 GUI"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it is just a text and no explicit TS code is being added here, you can just use |
||
</main> | ||
<ControlPanel /> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.status-bar { | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
display: flex; | ||
justify-content: space-around; | ||
padding: 10px; | ||
background-color: gray; | ||
} | ||
|
||
.status-button { | ||
padding: 10px 20px; | ||
border: none; | ||
border-radius: 5px; | ||
font-size: 1rem; | ||
font-weight: bold; | ||
cursor: pointer; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding padding to status-bar, you can add margin to status-button. This will make the gui more responsive to different screen sizes |
||
|
||
.run { background-color: #4CAF50; color: white; } | ||
.stop { background-color: #F44336; color: white; } | ||
.halt { background-color: #FFA500; color: white; } | ||
.load { background-color: #FFD700; color: white; } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import './ControlPanel.css'; | ||
|
||
function ControlPanel() { | ||
return ( | ||
<footer className="status-bar"> | ||
<button className="status-button run">Run</button> | ||
<button className="status-button stop">Stop</button> | ||
<button className="status-button halt">Halt</button> | ||
<button className="status-button load">Load</button> | ||
</footer> | ||
); | ||
} | ||
|
||
export default ControlPanel; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.navbar { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
|
||
font-size: 1.5rem; | ||
background-color: grey; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
color: white; | ||
font-weight: normal; | ||
|
||
height: 40px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific reason for adding a constant height to the navbar? |
||
padding: 0 10px; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import HX from "../../images/HX_Logo.svg"; | ||
|
||
import "./Navbar.css"; | ||
|
||
function Navbar() { | ||
return ( | ||
<header className="navbar"> | ||
<img alt="HX logo" src={HX} style={{ height: "30px" }} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use relative units for height of the image, something like rem. This way if I have a different font size, it won't look weird next to the logo |
||
HyperXite | ||
</header> | ||
); | ||
} | ||
|
||
export default Navbar; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.status-indicator-container { | ||
position: fixed; | ||
left: 10px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
width: 70px; | ||
height: 300px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding constant height and width to the status indicator, can we make it relative? |
||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: center; | ||
background-color: gray; | ||
padding: 15px 0; | ||
border-radius: 10px; | ||
} | ||
|
||
.status-label { | ||
font-size: 16px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make the font size relative |
||
font-weight: bold; | ||
color: white; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.status-circles { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-around; | ||
align-items: center; | ||
height: 80%; | ||
} | ||
|
||
.status-circle { | ||
width: 40px; | ||
height: 40px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this relative to the parent div? |
||
border-radius: 50%; | ||
border: 2px solid #333; | ||
opacity: 0.3; | ||
transition: opacity 0.3s ease; | ||
} | ||
|
||
.status-circle.red { | ||
background-color: #F44336; | ||
} | ||
|
||
.status-circle.yellow { | ||
background-color: #FFA500; | ||
} | ||
|
||
.status-circle.green { | ||
background-color: #4CAF50; | ||
} | ||
|
||
.status-circle.active { | ||
opacity: 1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import './StatusIndicator.css'; | ||
|
||
type StatusType = 'green' | 'yellow' | 'red'; | ||
|
||
interface StatusIndicatorProps { | ||
status: StatusType; | ||
} | ||
|
||
function StatusIndicator({ status }: StatusIndicatorProps) { | ||
return ( | ||
<div className="status-indicator-container"> | ||
<div className="status-label">Status</div> | ||
<div className="status-circles"> | ||
<div className={`status-circle green ${status === 'green' ? 'active' : ''}`}></div> | ||
<div className={`status-circle yellow ${status === 'yellow' ? 'active' : ''}`}></div> | ||
<div className={`status-circle red ${status === 'red' ? 'active' : ''}`}></div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default StatusIndicator; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
declare module "*.svg" { | ||
import React = require("react"); | ||
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>; | ||
const src: string; | ||
export default src; | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason for having a PNG of the logo too? |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a specific reason index.tsx was created. Since, it is the same as main.tsx. Try to use main.tsx. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import './index.css'; | ||
import App from './App'; | ||
|
||
// const root = ReactDOM.createRoot( | ||
// document.getElementById('root') as HTMLElement | ||
// ); | ||
// root.render( | ||
// <React.StrictMode> | ||
// <App /> | ||
// </React.StrictMode> | ||
// ); | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,31 @@ | ||
{ | ||
"files": [], | ||
"references": [ | ||
{ "path": "./tsconfig.app.json" }, | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["src/*"] | ||
}, | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"], | ||
"references": [ | ||
{ "path": "./tsconfig.node.json" } | ||
] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to use absolute addresses wherever possible