Skip to content

Commit

Permalink
feat: libname_short
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Aug 16, 2024
1 parent dae9ea5 commit 21658ac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
libname:
required: true
type: string
libname_short:
type: string
home_redirect:
required: true
type: string
Expand Down Expand Up @@ -42,6 +44,7 @@ jobs:
-e DIST_DIR="$MDX/out$BASE_PATH" \
-e MDX \
-e NEXT_PUBLIC_LIBNAME \
-e NEXT_PUBLIC_LIBNAME_SHORT \
-e OUTPUT=export \
-e HOME_REDIRECT \
-e MDX_BASEURL \
Expand All @@ -54,6 +57,7 @@ jobs:
BASE_PATH: ${{ steps.set-base-path.outputs.BASE_PATH }}
MDX: ${{ inputs.mdx }}
NEXT_PUBLIC_LIBNAME: ${{ inputs.libname }}
NEXT_PUBLIC_LIBNAME_SHORT: ${{ inputs.libname_short }}
HOME_REDIRECT: ${{ inputs.home_redirect }}
MDX_BASEURL: 'https://github.com/${{ github.repository }}/raw/${{ github.ref_name }}/${{ inputs.mdx }}'
EDIT_BASEURL: 'https://github.com/${{ github.repository }}/edit/${{ github.ref_name }}/${{ inputs.mdx }}'
Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Configuration

| var | description | example |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| `MDX`\* | Path to `*.mdx` folder<br>NB: can be relative or absolute | `docs` or `~/code/myproject/documentation` |
| `NEXT_PUBLIC_LIBNAME`\* | Library name | `React Three Fiber` |
| `BASE_PATH` | Base path for the final URL | `/react-three-fiber` |
| `DIST_DIR` | Path to the output folder ([within project](https://nextjs.org/docs/app/api-reference/next-config-js/distDir#:~:text=should%20not%20leave%20your%20project%20directory)) | `out` or `docs/out/react-three-fiber` |
| `OUTPUT` | Set to `export` for static output | `export` |
| `HOME_REDIRECT` | Where the home should redirect | `/getting-started/introduction` |
| `MDX_BASEURL` | Base URL for inlining relative images | `http://localhost:60141`or `https://github.com/pmndrs/react-three-fiber/raw/master/docs` |
| `EDIT_BASEURL` | Base URL for displaying "Edit this page" URLs | `https://github.com/pmndrs/react-three-fiber/edit/master/docs` |
| `NEXT_PUBLIC_URL` | Final URL of the published website | `https://pmndrs.github.io/react-three-fiber` |
| `ICON` | Emoji or image to use as (fav)icon (path local to `MDX`) | `🇨🇭` or `/icon.png` or `/favicon.ico` |
| `LOGO` | Logo src/path (either FQURL or local to `MDX` path) | `/logo.png` or `https://worldvectorlogo.com/r3f.png` |
| var | description | example |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| `MDX`\* | Path to `*.mdx` folder<br>NB: can be relative or absolute | `docs` or `~/code/myproject/documentation` |
| `NEXT_PUBLIC_LIBNAME`\* | Library name | `React Three Fiber` |
| `NEXT_PUBLIC_LIBNAME_SHORT` | Library short name | `r3f` |
| `BASE_PATH` | Base path for the final URL | `/react-three-fiber` |
| `DIST_DIR` | Path to the output folder ([within project](https://nextjs.org/docs/app/api-reference/next-config-js/distDir#:~:text=should%20not%20leave%20your%20project%20directory)) | `out` or `docs/out/react-three-fiber` |
| `OUTPUT` | Set to `export` for static output | `export` |
| `HOME_REDIRECT` | Where the home should redirect | `/getting-started/introduction` |
| `MDX_BASEURL` | Base URL for inlining relative images | `http://localhost:60141`or `https://github.com/pmndrs/react-three-fiber/raw/master/docs` |
| `EDIT_BASEURL` | Base URL for displaying "Edit this page" URLs | `https://github.com/pmndrs/react-three-fiber/edit/master/docs` |
| `NEXT_PUBLIC_URL` | Final URL of the published website | `https://pmndrs.github.io/react-three-fiber` |
| `ICON` | Emoji or image to use as (fav)icon (path local to `MDX`) | `🇨🇭` or `/icon.png` or `/favicon.ico` |
| `LOGO` | Logo src/path (either FQURL or local to `MDX` path) | `/logo.png` or `https://worldvectorlogo.com/r3f.png` |

\* Required

Expand Down Expand Up @@ -49,6 +50,7 @@ $ (
# [Config](https://github.com/pmndrs/docs#configuration)
export MDX=~/code/pmndrs/react-three-fiber/docs
export NEXT_PUBLIC_LIBNAME="React Three Fiber"
export NEXT_PUBLIC_LIBNAME_SHORT="r3f"
export BASE_PATH=
export DIST_DIR=
export OUTPUT=export
Expand Down Expand Up @@ -85,6 +87,7 @@ $ (
# [Config](https://github.com/pmndrs/docs#configuration)
export MDX=~/code/pmndrs/react-three-fiber/docs
export NEXT_PUBLIC_LIBNAME="React Three Fiber"
export NEXT_PUBLIC_LIBNAME_SHORT="r3f"
export BASE_PATH=
export DIST_DIR=
export OUTPUT=export
Expand Down Expand Up @@ -123,6 +126,7 @@ $ (
# [Config](https://github.com/pmndrs/docs#configuration)
export MDX=./docs
export NEXT_PUBLIC_LIBNAME="React Three Fiber"
export NEXT_PUBLIC_LIBNAME_SHORT="r3f"
export BASE_PATH=
export OUTPUT=export
export HOME_REDIRECT=/getting-started/introduction
Expand Down Expand Up @@ -168,6 +172,7 @@ uses: pmndrs/docs/.github/workflows/build.yml@main
with:
mdx: './docs'
libname: 'React Three Fiber'
libname_short: 'r3f'
home_redirect: '/getting-started/introduction'
icon: '🇨🇭'
logo: '/logo.png'
Expand Down
8 changes: 7 additions & 1 deletion src/app/[...slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default async function Layout({ params, children }: Props) {
const nextPage = currentPageIndex < docs.length - 1 && docs[currentPageIndex + 1]

const NEXT_PUBLIC_LIBNAME = process.env.NEXT_PUBLIC_LIBNAME
const NEXT_PUBLIC_LIBNAME_SHORT = process.env.NEXT_PUBLIC_LIBNAME_SHORT

return (
<>
Expand All @@ -37,7 +38,12 @@ export default async function Layout({ params, children }: Props) {
<>
<div className="h-full flex items-center flex-none p-2 pl-4 sm:pl-6 xl:pl-4 lg:w-60 xl:w-72">
<Link href="/" aria-label="Poimandres Docs">
<span className="font-bold">{NEXT_PUBLIC_LIBNAME}</span>
<span className="font-bold">
{NEXT_PUBLIC_LIBNAME_SHORT && (
<span className="inline lg:hidden">{NEXT_PUBLIC_LIBNAME_SHORT}</span>
)}
<span className="hidden lg:inline">{NEXT_PUBLIC_LIBNAME}</span>
</span>
</Link>
<span className="font-normal">
.<a href="https://docs.pmnd.rs">docs</a>
Expand Down

0 comments on commit 21658ac

Please sign in to comment.