Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration: upgraded the docs codebase from Nextra 3.X to 4.X & added tailwind 4 support #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/app/[[...mdxPath]]/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { generateStaticParamsFor, importPage } from "nextra/pages";
import { useMDXComponents } from "@/mdx-components";

export const generateStaticParams = generateStaticParamsFor("mdxPath");

export async function generateMetadata(props) {
const params = await props.params;
const { metadata } = await importPage(params.mdxPath);
return metadata;
}

const Wrapper = useMDXComponents().wrapper;

export default async function Page(props) {
const params = await props.params;
const result = await importPage(params.mdxPath);
const { default: MDXContent, toc, metadata } = result;
return (
<Wrapper toc={toc} metadata={metadata}>
<MDXContent {...props} params={params} />
</Wrapper>
);
}
Binary file added docs/app/favicon.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "tailwindcss";

64 changes: 64 additions & 0 deletions docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Footer, Layout, Link, Navbar } from 'nextra-theme-docs'
import { Banner, Head } from 'nextra/components'
import { getPageMap } from 'nextra/page-map'
import type { Metadata } from 'next'
import type { ReactNode } from 'react'
import 'nextra-theme-docs/style.css'
import './globals.css'

export const metadata: Metadata = {
title: 'Bikram-Sambat',
description: 'Bikram Sambat calendar system'
}

const footer = (
<Footer>
<div style={{ margin: 'auto' }}>
Bikram Sambat by{' '}
<Link style={{ color: 'red' }} href="https://github.com/askbuddie/">
Ask Buddie
</Link>
</div>
</Footer>
)

export default async function RootLayout({
children
}: {
children: ReactNode
}) {
return (
<html lang="en" dir="ltr" suppressHydrationWarning>
<Head>
{/* KaTeX CSS */}
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css"
/>
</Head>
<body>
<Layout
navbar={
<Navbar
logo={
<>
<span style={{ marginLeft: '.4em', fontWeight: 600, }}>
Bikram Sambat
</span>
</>
}
projectLink="https://github.com/askbuddie/bikram-sambat"
chatLink="https://dsc.gg/askbuddie"
/>
}
pageMap={await getPageMap()}
docsRepositoryBase="https://github.com/askbuddie/bikram-sambat"
editLink="Edit this page on GitHub"
sidebar={{ defaultMenuCollapseLevel: 1, autoCollapse: true }}
footer={footer}>
{children}
</Layout>
</body>
</html>
)
}
1 change: 1 addition & 0 deletions docs/app/not-found.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NotFoundPage as default } from "nextra-theme-docs";
Binary file added docs/app/opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions docs/pages/_meta.json → docs/content/_meta.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
export default{
"index": "About",
"introduction": "Introduction",
"table-of-contents": "Table of contents",
"initialization": "Initialization",
"constructor": "Constructor",
"constructor-function": "Constructor",
"properties": "Properties",
"working-with-dates": "Working with Dates",
"formating-dates": "Formating Dates",
"comparing-dates": "Comparing Dates",
"fetching-relative-dates": "Fetching Relative Dates",
"static-methods": "Static Methods",
"contact": {
"title": "Contact",
"title": "Contact",
"type": "page",
"href": "https://www.facebook.com/askbuddie",
"newWindow": true
"href": "https://www.facebook.com/askbuddie"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default{
"is-after": "isAfter",
"is-before": "isBefore",
"is-same-day": "isSameDay",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default{
"get-previous-day": "getPreviousDay",
"get-next-day": "getNextDay",
"get-week-start-date": "getWeekStartDate",
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions docs/content/formating-dates/_meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default{
"format": "format",
"toStringConvert": "toString"
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default{
"with-date-string": "Initializing with a Date String",
"with-another-date-instance": "Initializing with Another BikramSambat Instance",
"default-initialization": "Default Initialization"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default{
"get-next-year": "getNextYear",
"get-previous-year": "getPreviousYear",
"to-ad": "toAD",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default{
"to-ad": "toAD",
"from-ad": "fromAD",
"get-weekday-names": "getWeekdayNames",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default{
"get-day": "getDay",
"get-month": "getMonth",
"get-year": "getYear",
Expand Down
8 changes: 8 additions & 0 deletions docs/mdx-components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { useMDXComponents as getDocsMDXComponents } from 'nextra-theme-docs'

const docsComponents = getDocsMDXComponents()

export const useMDXComponents: typeof getDocsMDXComponents = components => ({
...docsComponents,
...components
})
2 changes: 1 addition & 1 deletion docs/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
12 changes: 0 additions & 12 deletions docs/next.config.js

This file was deleted.

29 changes: 29 additions & 0 deletions docs/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// import type { NextConfig } from "next";

import { NextConfig } from "next";

import nextra from "nextra";

const withNextra = nextra({
latex: {
renderer: 'katex',
options: {
macros: {
'\\RR': '\\mathbb{R}',
},
strict: 'ignore',
},
},
defaultShowCopyCode: true,
contentDirBasePath: "/",
});

const nextConfig: NextConfig = withNextra({
output: 'export',
images: {
unoptimized: true // mandatory, otherwise won't export
},
reactStrictMode: false,
});

export default nextConfig;
16 changes: 11 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@askbuddie/bikram-sambat-docs",
"version": "1.0.0",
"description": "Documentation for Bikram Sambat library by Ask Buddie",
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
Expand All @@ -18,14 +19,19 @@
"license": "MIT",
"homepage": "https://github.com/askbuddie/bikram-sambat#readme",
"dependencies": {
"next": "^14.2.21",
"@tailwindcss/postcss": "^4.0.0",
"next": "^15.1.6",
"nextra": "latest",
"nextra-theme-docs": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "^4.0.3"
},
"devDependencies": {
"@types/node": "18.11.10",
"typescript": "^4.9.3"
"@types/node": "^20.17.17",
"@types/react": "^19.0.8",
"@types/tailwindcss": "^3.1.0",
"pagefind": "^1.3.0",
"typescript": "^5.7.3"
}
}
4 changes: 0 additions & 4 deletions docs/pages/formating-dates/_meta.json

This file was deleted.

Loading