From b3fd80cf21276c10ca13b8206faad3fd1cde9cb1 Mon Sep 17 00:00:00 2001 From: Benedikt Schwab Date: Thu, 3 Oct 2024 12:59:14 +0200 Subject: [PATCH] switch to typescript config --- package.json | 6 +++--- pages/index.mdx | 8 ++++---- pnpm-lock.yaml | 42 +++++++++++++++++++++--------------------- tailwind.config.js | 8 -------- tailwind.config.ts | 14 ++++++++++++++ theme.config.tsx | 46 ++++++++++++++++++++++++++++++++++++++++++---- 6 files changed, 84 insertions(+), 40 deletions(-) delete mode 100644 tailwind.config.js create mode 100644 tailwind.config.ts diff --git a/package.json b/package.json index fed083a..d79dc9d 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "@fontsource/open-sans": "^5.1.0", "@reach/skip-nav": "^0.18.0", "next": "^14.2.14", - "nextra": "3.0.2", - "nextra-theme-docs": "3.0.2", + "nextra": "3.0.3", + "nextra-theme-docs": "3.0.3", "react": "18.3.1", "react-dom": "18.3.1", "sharp": "^0.33.5", @@ -25,7 +25,7 @@ }, "devDependencies": { "@types/node": "22.7.4", - "@types/react": "18.3.10", + "@types/react": "18.3.11", "@types/react-dom": "18.3.0", "autoprefixer": "^10.4.20", "postcss": "^8.4.47", diff --git a/pages/index.mdx b/pages/index.mdx index 40366af..4b393a4 100644 --- a/pages/index.mdx +++ b/pages/index.mdx @@ -1,8 +1,8 @@ -import RtronLogo from "../components/logos/rtron"; +--- +title: R:trån – Processing Library for Road Space Models +--- -{ -// wrapped with {} to mark it as javascript so mdx will not put it under a p tag -} +import RtronLogo from "../components/logos/rtron";
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fbd7712..2a88a20 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,11 +18,11 @@ importers: specifier: ^14.2.14 version: 14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1) nextra: - specifier: 3.0.2 - version: 3.0.2(@types/react@18.3.10)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2) + specifier: 3.0.3 + version: 3.0.3(@types/react@18.3.11)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2) nextra-theme-docs: - specifier: 3.0.2 - version: 3.0.2(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.0.2(@types/react@18.3.10)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 3.0.3 + version: 3.0.3(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.0.3(@types/react@18.3.11)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: specifier: 18.3.1 version: 18.3.1 @@ -40,8 +40,8 @@ importers: specifier: 22.7.4 version: 22.7.4 '@types/react': - specifier: 18.3.10 - version: 18.3.10 + specifier: 18.3.11 + version: 18.3.11 '@types/react-dom': specifier: 18.3.0 version: 18.3.0 @@ -553,8 +553,8 @@ packages: '@types/react-dom@18.3.0': resolution: {integrity: sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==} - '@types/react@18.3.10': - resolution: {integrity: sha512-02sAAlBnP39JgXwkAq3PeU9DVaaGpZyF3MGcC0MKgQVkZor5IiiDAipVaxQHtDJAmO4GIy/rVBy/LzVj76Cyqg==} + '@types/react@18.3.11': + resolution: {integrity: sha512-r6QZ069rFTjrEYgFdOck1gK7FLVsgJE7tTz0pQBczlBNUhBNk0MQH4UbnFSwjpQLMkLzgqvBBa+qGpLje16eTQ==} '@types/unist@2.0.11': resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} @@ -1593,16 +1593,16 @@ packages: sass: optional: true - nextra-theme-docs@3.0.2: - resolution: {integrity: sha512-bTNE7rnUm8z+6soWsHub9hDQ+pwXNQFxPGDGcMx4YomCFeeOfW2g0UkYfGQS7TId9JN3/ufmXTk7pCxZFRPxBg==} + nextra-theme-docs@3.0.3: + resolution: {integrity: sha512-zC1mrASoYttM2rjAiUhmftM4gNb6UGtPhOO/oS68ky6ZdqLMp6i9UBgnECrjPRZdfOL3c+VAWRPjBM2B7a80Dw==} peerDependencies: next: '>=13' - nextra: 3.0.2 + nextra: 3.0.3 react: '>=18.0.0' react-dom: '>=18.0.0' - nextra@3.0.2: - resolution: {integrity: sha512-5cjEkw8+6UQZhSfb67hbAR2uNovDGT6vQg0I6cL4QzAnO45pwkuMLqooXo3iXIG32x3X8TTH5gXNOS/jNqFnRw==} + nextra@3.0.3: + resolution: {integrity: sha512-14NdEDZCdyZBrihbMBdGon3aq6feYVNonetHQrYXIVcCxuUsh9CNYRUX5bImpE3zQ6cfXDnRJsG70tHDbXdHMQ==} engines: {node: '>=18'} peerDependencies: next: '>=13' @@ -2452,10 +2452,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@mdx-js/react@3.0.1(@types/react@18.3.10)(react@18.3.1)': + '@mdx-js/react@3.0.1(@types/react@18.3.11)(react@18.3.1)': dependencies: '@types/mdx': 2.0.13 - '@types/react': 18.3.10 + '@types/react': 18.3.11 react: 18.3.1 '@mermaid-js/parser@0.3.0': @@ -2719,9 +2719,9 @@ snapshots: '@types/react-dom@18.3.0': dependencies: - '@types/react': 18.3.10 + '@types/react': 18.3.11 - '@types/react@18.3.10': + '@types/react@18.3.11': dependencies: '@types/prop-types': 15.7.13 csstype: 3.1.3 @@ -4166,7 +4166,7 @@ snapshots: - '@babel/core' - babel-plugin-macros - nextra-theme-docs@3.0.2(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.0.2(@types/react@18.3.10)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + nextra-theme-docs@3.0.3(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.0.3(@types/react@18.3.11)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@headlessui/react': 2.1.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) clsx: 2.1.1 @@ -4174,17 +4174,17 @@ snapshots: flexsearch: 0.7.43 next: 14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1) next-themes: 0.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - nextra: 3.0.2(@types/react@18.3.10)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2) + nextra: 3.0.3(@types/react@18.3.11)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2) react: 18.3.1 react-dom: 18.3.1(react@18.3.1) scroll-into-view-if-needed: 3.1.0 zod: 3.23.8 - nextra@3.0.2(@types/react@18.3.10)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2): + nextra@3.0.3(@types/react@18.3.11)(next@14.2.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2): dependencies: '@headlessui/react': 2.1.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mdx-js/mdx': 3.0.1 - '@mdx-js/react': 3.0.1(@types/react@18.3.10)(react@18.3.1) + '@mdx-js/react': 3.0.1(@types/react@18.3.11)(react@18.3.1) '@napi-rs/simple-git': 0.1.19 '@shikijs/twoslash': 1.21.0(typescript@5.6.2) '@theguild/remark-mermaid': 0.1.3(react@18.3.1) diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index 2ae0b8e..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - mode: "jit", - content: [ - "./components/**/*.js", - "./pages/**/*.{md,mdx}", - "./theme.config.tsx", - ], -}; \ No newline at end of file diff --git a/tailwind.config.ts b/tailwind.config.ts new file mode 100644 index 0000000..de5ecc0 --- /dev/null +++ b/tailwind.config.ts @@ -0,0 +1,14 @@ +import type { Config } from 'tailwindcss' + +export default { + content: [ + './pages/**/*.{js,ts,jsx,tsx,mdx}', + './components/**/*.{js,ts,jsx,tsx}', + './theme.config.tsx' + ], + theme: { + extend: {} + }, + plugins: [], + darkMode: 'class' +} satisfies Config \ No newline at end of file diff --git a/theme.config.tsx b/theme.config.tsx index 5b01df8..4fbcb58 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -3,6 +3,7 @@ import {useConfig} from 'nextra-theme-docs' import TumLogo from './components/logos/tum' import SavenowLogo from './components/logos/savenow' import RtronSmallLogo from "./components/logos/rtron-small"; +import {useRouter} from "next/router"; const config: DocsThemeConfig = { project: { @@ -27,10 +28,47 @@ const config: DocsThemeConfig = { ), - head: () => ( - <> - - ), + head: function useHead() { + const config = useConfig() + const { route } = useRouter() + const isDefault = route === '/' || !config.title + + const description = + config.frontMatter.description || + 'Processing Library for Road Space Models.' + const title = config.title + (route === '/' ? '' : ' - r:trån') + + return ( + <> + {title} + + + + + + + + + + + + + + + + + ) + }, footer: { content: ( <>