Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
site
Browse files Browse the repository at this point in the history
  • Loading branch information
slmjkdbtl committed Oct 4, 2023
1 parent e6c7d20 commit d943a85
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 12 deletions.
13 changes: 10 additions & 3 deletions site/comps/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO: use react-markdown

import * as React from "react"
import { Marked } from "marked"
import { markedHighlight } from "marked-highlight"
Expand Down Expand Up @@ -28,7 +30,7 @@ const Markdown: React.FC<MarkdownProps & ViewProps> = ({
dim,
...args
}) => {
const [marked, _] = React.useState(() => {
const [marked] = React.useState(() => {
const marked = new Marked()
if (baseUrl) {
marked.use(markedBaseUrl.baseUrl(baseUrl))
Expand All @@ -41,13 +43,18 @@ const Markdown: React.FC<MarkdownProps & ViewProps> = ({
}))
return marked
})
const html = React.useMemo(() => {
const res = marked.parse(src)
if (res instanceof Promise) throw new Error("wtf???")
return res
}, [src, marked])
return (
<View
stretchX
gap={2}
// @ts-ignore
// @ts-ignore
dangerouslySetInnerHTML={{
__html: marked.parse(src),
__html: html,
}}
css={{
"*": {
Expand Down
6 changes: 6 additions & 0 deletions site/comps/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ const Page = ({
color: var(--color-highlight);
cursor: pointer;
}
code {
background: red;
padding: 2px 8px;
border-radius: 4px;
background: var(--color-bg3);
}
#__next {
width: 100%;
height: 100%;
Expand Down
44 changes: 35 additions & 9 deletions site/pages/kaboomware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ const squeezeGame = {
\`\`\`
`.trim()

const props = [
{ name: "prompt", desc: "The title of the game, telling player what they should do. (Usually just a simple verb!)" },
]

const Prop = ({
title,
desc,
}: {
title: string,
desc: string,
}) => (
<View dir="row" align="center" gap={2}>
<Text code size="big" bold><code>{title}</code></Text>
<Text>{desc}</Text>
</View>
)

export default function Doc() {
const wareRef = React.useRef(null)
React.useEffect(() => {
Expand All @@ -57,12 +74,12 @@ export default function Doc() {
return (
<View
align="center"
gap={5}
gap={4}
padX={3}
stretch
css={{
width: "100%",
maxWidth: "640px",
maxWidth: "800px",
margin: "64px auto",
}}>
<Global
Expand All @@ -74,7 +91,7 @@ export default function Doc() {
`}
/>
<img
src="/static/img/kaboomware.png"
src="/static/img/kaboomware/logo.png"
css={{
width: 480,
maxWidth: "100%",
Expand All @@ -87,20 +104,29 @@ export default function Doc() {
align="center"
width="100%"
>
<img
src="/static/img/ken.png"
css={{
width: 160,
}}
/>
<img src="/static/img/kaboomware/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>
<View dir="row" gap={2} align="center">
<Text>There will be a monthly KaboomWare game jam, where you make as many KaboomWare mini-games as possible! (they have to be fun tho)</Text>
<img src="/static/img/kaboomware/cal.png" />
</View>
<Text color={2}>A KaboomWare mini-game is just a JavaScript object, with 5 entries:</Text>
<View gap={2}>
<Prop title="prompt" desc="The title of the game, telling player what they should do. (Usually just a simple verb!)" />
<Prop title="author" desc="Your name" />
<Prop title="hue" desc="Hue of the background of the game (0.0 - 1.0)." />
<Prop title="onLoad" desc="Load assets of your mini-game" />
<Prop title="onStart" desc="Main entry point of your mini-game gameplay. Should return a Kaboom game object that contains the entire scene and behavior." />
</View>
<Text color={2}>Here is an example mini-game!</Text>
<Markdown src={example} />
<Text>For more examples, see <a href="https://github.com/slmjkdbtl/kaboomware/tree/master/example/games">here</a></Text>
</View>
)
}
Binary file removed site/public/static/img/kaboomware.png
Binary file not shown.
Binary file added site/public/static/img/kaboomware/cal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added site/public/static/img/kaboomware/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d943a85

Please sign in to comment.