-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
156 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { type Packument } from "query-registry"; | ||
import { useEffect, useState } from "react"; | ||
|
||
async function getPackageInfo(name: string): Promise<Packument> { | ||
const endpoint = `https://registry.npmjs.org/${name}`; | ||
const res = await fetch(endpoint); | ||
const data = await res.json(); | ||
return data; | ||
} | ||
|
||
export const ConfigProject = () => { | ||
const [packageInfo, setPackageInfo] = useState<Packument | null>( | ||
null, | ||
); | ||
|
||
useEffect(() => { | ||
async function fetchPackageInfo() { | ||
const info = await getPackageInfo("kaplay"); | ||
setPackageInfo(info); | ||
} | ||
|
||
fetchPackageInfo(); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<h2 className="text-2xl font-bold pb-4">Project configuration</h2> | ||
|
||
<label className="form-control w-full max-w-xs"> | ||
<div className="label"> | ||
<span className="label-text"> | ||
KAPLAY.js version: | ||
</span> | ||
</div> | ||
<select | ||
id="version-selector" | ||
className="select select-bordered" | ||
> | ||
{packageInfo | ||
&& Object.keys(packageInfo.versions).reverse().map(( | ||
version, | ||
) => ( | ||
<option key={version} value={version}> | ||
{version} | ||
</option> | ||
))} | ||
</select> | ||
</label> | ||
</> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { ComponentProps, FC } from "react"; | ||
import { View } from "./View"; | ||
|
||
type Props = ComponentProps<"dialog"> & { | ||
onSave?: () => void; | ||
onCloseWithoutSave?: () => void; | ||
}; | ||
|
||
export const Dialog: FC<Props> = (props) => { | ||
return ( | ||
<View className="modal" el={"dialog"} id={props.id} {...props}> | ||
<main className="modal-box overflow-hidden px-0 py-0"> | ||
<section className="max-h-[400px] overflow-y-auto p-4"> | ||
{props.children} | ||
</section> | ||
|
||
<footer className="p-4 bg-base-200"> | ||
<div className="modal-action"> | ||
<form method="dialog"> | ||
<button | ||
className="btn btn-primary" | ||
onClick={props.onSave} | ||
> | ||
Save Changes | ||
</button> | ||
</form> | ||
</div> | ||
</footer> | ||
</main> | ||
<form | ||
method="dialog" | ||
className="modal-backdrop" | ||
> | ||
<button | ||
onClick={props.onCloseWithoutSave} | ||
> | ||
Close | ||
</button> | ||
</form> | ||
</View> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters