This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 227
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
14 changed files
with
159 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
"extends": "next/core-web-vitals", | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": "warn" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
import * as React from "react"; | ||
import * as React from "react" | ||
|
||
export default function useFetch<D>( | ||
url: string | null, | ||
parse: (res: Response) => Promise<D> | ||
parse: (res: Response) => Promise<D>, | ||
) { | ||
|
||
const [ res, setRes ] = React.useState<Response | null>(null); | ||
const [ data, setData ] = React.useState<D | null>(null); | ||
const [ loading, setLoading ] = React.useState(true); | ||
const [ err, setErr ] = React.useState(null); | ||
const [ res, setRes ] = React.useState<Response | null>(null) | ||
const [ data, setData ] = React.useState<D | null>(null) | ||
const [ loading, setLoading ] = React.useState(true) | ||
const [ err, setErr ] = React.useState(null) | ||
|
||
React.useEffect(() => { | ||
|
||
if (!url) { | ||
return; | ||
return | ||
} | ||
|
||
let didCancel = false; | ||
let didCancel = false | ||
|
||
fetch(url) | ||
.then((res) => { | ||
if (!didCancel) { | ||
setRes(res); | ||
setRes(res) | ||
} | ||
return parse(res); | ||
return parse(res) | ||
}) | ||
.then((d) => { | ||
if (didCancel) return; | ||
setData(d); | ||
setLoading(false); | ||
if (didCancel) return | ||
setData(d) | ||
setLoading(false) | ||
}) | ||
.catch((e) => { | ||
if (didCancel) return; | ||
setErr(e); | ||
setLoading(false); | ||
}); | ||
if (didCancel) return | ||
setErr(e) | ||
setLoading(false) | ||
}) | ||
|
||
return () => { | ||
didCancel = true; | ||
}; | ||
didCancel = true | ||
} | ||
|
||
}, [ url ]); | ||
}, [ url ]) | ||
|
||
return { | ||
res, | ||
data, | ||
loading, | ||
err, | ||
}; | ||
} | ||
|
||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { Global, css } from "@emotion/react" | ||
import * as React from "react" | ||
import kaboomware from "kaboomware" | ||
import View from "comps/View" | ||
import Text from "comps/Text" | ||
import Markdown from "comps/Markdown" | ||
|
||
const bubble = css(` | ||
&:after { | ||
content: ''; | ||
position: absolute; | ||
left: 0; | ||
top: 50%; | ||
width: 0; | ||
height: 0; | ||
border: 10px solid transparent; | ||
border-right-color: #ffffff; | ||
border-left: 0; | ||
margin-top: 0px; | ||
margin-left: -10px; | ||
} | ||
`) | ||
|
||
const example = ` | ||
\`\`\`js | ||
const squeezeGame = { | ||
prompt: "Squeeze!", | ||
author: "tga", | ||
hue: 0.46, | ||
onLoad: (k) => { | ||
k.loadSound("fly", "sounds/fly.mp3") | ||
k.loadSprite("hand", "sprites/hand.png") | ||
}, | ||
onStart: (k) => { | ||
const scene = k.make() | ||
const hand = scene.add([ | ||
k.pos(420, 240), | ||
k.sprite("hand"), | ||
]) | ||
k.onButtonPress("action", () => { | ||
hand.squeeze() | ||
if (gotIt) { | ||
k.win() | ||
} | ||
}) | ||
return scene | ||
}, | ||
} | ||
\`\`\` | ||
`.trim() | ||
|
||
export default function Doc() { | ||
const wareRef = React.useRef(null) | ||
React.useEffect(() => { | ||
// const ware = kaboomware([]) | ||
}, []) | ||
return ( | ||
<View | ||
align="center" | ||
gap={5} | ||
padX={3} | ||
stretch | ||
css={{ | ||
width: "100%", | ||
maxWidth: "640px", | ||
margin: "64px auto", | ||
}}> | ||
<Global | ||
styles={css` | ||
img { | ||
image-rendering: crisp-edges; | ||
image-rendering: pixelated; | ||
} | ||
`} | ||
/> | ||
<img | ||
src="/static/img/kaboomware.png" | ||
css={{ | ||
width: 480, | ||
maxWidth: "100%", | ||
}} | ||
/> | ||
<Text size="big" align="center">KaboomWare is a mini-game engine + event based on Kaboom, inspired by the great WarioWare series.</Text> | ||
<View | ||
dir="row" | ||
gap={4} | ||
align="center" | ||
width="100%" | ||
> | ||
<img | ||
src="/static/img/ken.png" | ||
css={{ | ||
width: 160, | ||
}} | ||
/> | ||
<View gap={2} dir="column" stretchY justify="between" css={{ flex: 1 }}> | ||
<View bg="#ffffff" pad={2} rounded css={bubble}> | ||
<Text color="#000000">You must supply 100 mini-games per month, or we have to destroy your planet.</Text> | ||
</View> | ||
<Text color={3}>Ken (alien), KaboomWare operation lead</Text> | ||
</View> | ||
</View> | ||
<Markdown src={example} /> | ||
</View> | ||
) | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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