-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(website): add readme * fix: linting * fix: configuration * fix: configuration * fix: change implementation * fix: return JSX element * fix: build * fix: build * hack for website:dev * hydrate if ssr is enabled * disable ssr temporarily * debugging with console.log * Revert "debugging with console.log" This reverts commit 2b396df. * a hacky fix * Revert "disable ssr temporarily" This reverts commit 32c724e. * remove unused libs * remove unused libs * add comment --------- Co-authored-by: daishi <daishi@axlight.com>
- Loading branch information
Showing
16 changed files
with
2,267 additions
and
111 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
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,32 @@ | ||
// FIXME we should be able to remove this directive | ||
'use client'; | ||
|
||
import type { ComponentPropsWithoutRef, ElementType } from 'react'; | ||
|
||
type ButtonProps = ComponentPropsWithoutRef<'button'> & | ||
ComponentPropsWithoutRef<'a'>; | ||
|
||
export const Button = ({ href, children, ...rest }: ButtonProps) => { | ||
let Element: ElementType = 'button'; | ||
const props: ButtonProps = {}; | ||
|
||
if (href) { | ||
Element = 'a'; | ||
props.href = href; | ||
|
||
if (href.startsWith('http')) { | ||
props.target = '_blank'; | ||
props.rel = 'noopener noreferrer'; | ||
} | ||
} | ||
|
||
return ( | ||
<Element | ||
className="rounded-md bg-red-900 px-4 py-3 text-base font-black uppercase leading-none tracking-wide text-red-50 transition duration-300 ease-in-out hover:bg-red-800" | ||
{...props} | ||
{...rest} | ||
> | ||
{children} | ||
</Element> | ||
); | ||
}; |
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,26 +1,11 @@ | ||
import { Code } from 'bright'; | ||
import { Code as Component } from 'bright'; | ||
|
||
const code1 = ` | ||
import { lazy } from "react"; | ||
import { defineEntries } from "waku/server"; | ||
import theme from '../theme.json'; | ||
|
||
const App = lazy(() => import("./components/App.js")); | ||
type CodeProps = { | ||
code: string; | ||
}; | ||
|
||
export default defineEntries( | ||
// renderEntries | ||
async (input) => { | ||
return { | ||
App: <App name={input || "Waku"} />, | ||
}; | ||
}, | ||
); | ||
`.trim(); | ||
|
||
export const Code1 = () => ( | ||
<Code | ||
className="border-cVanilla !m-0 max-w-xs overflow-scroll !rounded-2xl border-2 !p-0 sm:max-w-sm md:max-w-md lg:max-w-full" | ||
theme="solarized-dark" | ||
code={code1} | ||
lang="tsx" | ||
/> | ||
export const Code = ({ code, ...rest }: CodeProps) => ( | ||
<Component lang="tsx" theme={theme} code={code.trim()} {...rest} /> | ||
); |
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,61 @@ | ||
import fs from 'node:fs'; | ||
// @ts-expect-error no exported member | ||
import { MDXRemote } from 'next-mdx-remote/rsc'; | ||
|
||
import { Code } from './code.js'; | ||
|
||
export const Content = () => { | ||
const file = fs.readFileSync('../../README.md', 'utf8'); | ||
const source = `## Introduction${file | ||
.split('## Introduction')[1] | ||
?.split('## Tweets')[0]}`; | ||
|
||
return <MDXRemote source={source} components={components} />; | ||
}; | ||
|
||
const components = { | ||
h2: ({ children, ...rest }: any) => ( | ||
<h2 | ||
className="mb-2 mt-16 text-[2.75rem] font-bold leading-none first-of-type:mt-0" | ||
{...rest} | ||
> | ||
{children} | ||
</h2> | ||
), | ||
h3: ({ children, ...rest }: any) => ( | ||
<h3 className="mb-2 mt-8 text-3xl font-bold leading-none" {...rest}> | ||
{children} | ||
</h3> | ||
), | ||
h4: ({ children, ...rest }: any) => ( | ||
<h3 | ||
{...rest} | ||
className="mb-2 mt-8 text-xl font-bold uppercase leading-none tracking-wide" | ||
> | ||
{children} | ||
</h3> | ||
), | ||
p: ({ children, ...rest }: any) => ( | ||
<p | ||
className="mb-4 text-lg font-normal leading-normal text-white/60 lg:text-xl" | ||
{...rest} | ||
> | ||
{children} | ||
</p> | ||
), | ||
code: ({ children, ...rest }: any) => ( | ||
<span | ||
className="-my-0.5 inline-block rounded bg-gray-800 px-1.5 py-px font-mono text-base text-white/80" | ||
{...rest} | ||
> | ||
{children} | ||
</span> | ||
), | ||
pre: ({ children, ...rest }: any) => ( | ||
<Code | ||
code={children.props.children} | ||
className="!-mx-[0.75em] !overflow-clip !rounded-xl !bg-gray-800 !p-[0.5em] !font-mono [&>*]:!bg-gray-800" | ||
{...rest} | ||
/> | ||
), | ||
}; |
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,30 @@ | ||
'use client'; | ||
|
||
import { Fragment } from 'react'; | ||
import type { ReactNode } from 'react'; | ||
import { useClickAway } from '@uidotdev/usehooks'; | ||
|
||
type ModalProps = { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
children: ReactNode; | ||
}; | ||
|
||
export const Modal = ({ isOpen, onClose, children }: ModalProps) => { | ||
const ref: any = useClickAway(onClose); | ||
|
||
if (!isOpen) return <Fragment />; | ||
|
||
return ( | ||
<div className="fixed inset-0 z-50 flex items-center justify-center p-8"> | ||
<div className="inline-block overflow-clip rounded-2xl border-8 border-gray-950 bg-gray-900 p-2"> | ||
<div | ||
ref={ref} | ||
className="relative aspect-[1/1] w-full max-w-4xl overflow-y-auto p-6 text-left text-white sm:aspect-[4/3] lg:aspect-[16/9] lg:p-10" | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
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,24 @@ | ||
'use client'; | ||
|
||
import { useState, Fragment } from 'react'; | ||
import type { ReactNode } from 'react'; | ||
|
||
import { Button } from './button.js'; | ||
import { Modal } from './modal.js'; | ||
|
||
type ReadmeProps = { | ||
children: ReactNode; | ||
}; | ||
|
||
export const Readme = ({ children }: ReadmeProps) => { | ||
const [isOpen, setIsOpen] = useState<boolean>(false); | ||
|
||
return ( | ||
<Fragment> | ||
<Button onClick={() => setIsOpen(true)}>Readme</Button> | ||
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)}> | ||
{children} | ||
</Modal> | ||
</Fragment> | ||
); | ||
}; |
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
Oops, something went wrong.
4be0dee
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.
Successfully deployed to the following URLs:
waku – ./
www.waku.gg
waku.gg
waku-daishi.vercel.app
waku.vercel.app
waku-git-main-daishi.vercel.app