make App() class

This commit is contained in:
SpikeHD
2022-05-09 23:30:59 -07:00
parent 635a6a5abb
commit a6d5f3404c
5 changed files with 71 additions and 10 deletions

View File

@@ -11,6 +11,14 @@ import ServerLaunchSection from './components/ServerLaunchSection'
import ProgressBar from './components/common/ProgressBar'
import MainProgressBar from './components/common/MainProgressBar'
interface IProps {
[key: string]: never
}
interface IState {
isDownloading: boolean
}
const downloadHandler = new DownloadHandler()
async function download(url: string, filename: string, path: string) {
@@ -26,20 +34,29 @@ async function TESTDOWNLOAD() {
)
}
function App() {
return (
<div className="App">
<Topbar />
class App extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props)
this.state = {
isDownloading: false,
}
}
<button onClick={TESTDOWNLOAD}>download file test</button>
render() {
return (
<div className="App">
<Topbar />
<ServerLaunchSection />
<button onClick={TESTDOWNLOAD}>download file test</button>
<div id="DownloadProgress">
<MainProgressBar downloadManager={downloadHandler} />
<ServerLaunchSection />
<div id="DownloadProgress">
<MainProgressBar downloadManager={downloadHandler} />
</div>
</div>
</div>
)
)
}
}
export default App

View File

View File

@@ -0,0 +1,22 @@
import React from 'react'
interface IProps {
children: React.ReactNode[] | React.ReactNode;
className?: string;
heading: string;
}
export default class Menu extends React.Component<IProps, never> {
constructor(props: IProps) {
super(props)
}
render() {
return (
<div className={'Menu ' + this.props.className}>
<div className="MenuHeading">{this.props.heading}</div>
{this.props.children}
</div>
)
}
}

View File

View File

@@ -0,0 +1,22 @@
import React from 'react'
import Menu from './Menu'
import './Options.css'
export default class Options extends React.Component<{}, never> {
constructor(props: Record<string, never>) {
super(props)
}
render() {
return (
<Menu className="Options" heading="Options">
<div className='OptionSection'>
<div className='OptionLabel'>Test Option</div>
<div className='OptionValue'>
<input type="checkbox" />
</div>
</div>
</Menu>
)
}
}