diff --git a/sites/dev/components/header/index.mjs b/sites/dev/components/header/index.mjs
index 1173e7d2bf2..55800457cf2 100644
--- a/sites/dev/components/header/index.mjs
+++ b/sites/dev/components/header/index.mjs
@@ -16,6 +16,7 @@ import {
DocsIcon,
WrenchIcon,
FreeSewingIcon,
+ HeartIcon,
} from 'shared/components/icons.mjs'
import { Ribbon } from 'shared/components/ribbon.mjs'
import { ModalThemePicker, ns as themeNs } from 'shared/components/modal/theme-picker.mjs'
@@ -33,6 +34,14 @@ export const ns = ['header', 'sections', ...themeNs]
* for translators
* how to work as a team
* about freesewing
+ *
+ *
+ * designers
+ * contributors
+ * api
+ * translation
+ * infra
+ * content
* */
const NavIcons = ({ setModal, setSearch }) => {
@@ -45,54 +54,44 @@ const NavIcons = ({ setModal, setSearch }) => {
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
setModal()}
label={t('header:theme')}
- color={colors[7]}
+ color={colors[8]}
>
- setSearch(true)} label={t('header:search')} color={colors[8]}>
+ setSearch(true)} label={t('header:search')} color={colors[9]}>
-
-
-
-
>
)
}
diff --git a/sites/dev/hooks/use-navigation.mjs b/sites/dev/hooks/use-navigation.mjs
index 8047abf1148..82b62c02a39 100644
--- a/sites/dev/hooks/use-navigation.mjs
+++ b/sites/dev/hooks/use-navigation.mjs
@@ -18,40 +18,46 @@ export const ns = ['account', 'sections', 'design', 'tags']
const sitePages = () => {
const pages = {
// Top-level pages that are the sections menu
- developers: {
- t: 'For all Developers',
- s: 'developers',
+ api: {
+ t: 'API Documentation',
+ s: 'api',
o: 10,
},
- designers: {
- t: 'For Pattern Designers & Coders',
- s: 'designers',
+ design: {
+ t: 'Design Sewing Patterns',
+ s: 'design',
+ o: 10,
+ },
+ contribute: {
+ t: 'Contribute to FreeSewing',
+ s: 'contribute',
o: 20,
},
- writers: {
- t: 'For Writers',
- s: 'writers',
- o: 30,
- },
- translators: {
- t: 'For Translators',
- s: 'translators',
+ i18n: {
+ t: 'Help Translate FreeSewing',
+ s: 'i18n',
o: 40,
},
- infrastructure: {
+ infra: {
t: 'FreeSewing Infrastructure',
- s: 'infrastructure',
+ s: 'infra',
o: 50,
},
- teamwork: {
- t: 'Open Source & Teamwork',
- s: 'teamwork',
- o: 60,
- },
about: {
t: 'About FreeSewing',
s: 'about',
- o: 99,
+ o: 60,
+ },
+ support: {
+ t: 'Support FreeSewing',
+ s: 'support',
+ o: 70,
+ },
+ sitemap: {
+ t: 'Sitemap',
+ s: 'sitemap',
+ o: 70,
+ h: 1,
},
}
return pages
@@ -78,7 +84,8 @@ const createSections = (nav) => {
return orderBy(sections, ['o', 't'])
}
-export const useNavigation = ({ path, locale = 'en' }) => {
+export const useNavigation = (params = {}) => {
+ const { path = [], locale = 'en' } = params
const nav = { ...pbn[locale], ...sitePages() }
// Hide top-level documentation entries
for (const page of ['tutorials', 'guides', 'howtos', 'reference', 'training']) {
@@ -95,5 +102,6 @@ export const useNavigation = ({ path, locale = 'en' }) => {
slug: path.join('/'),
nav: path.length > 1 ? get(nav, path[0]) : path.length === 0 ? sections : nav[path[0]],
title: crumbs.length > 0 ? crumbs.slice(-1)[0].t : '',
+ siteNav: nav,
}
}
diff --git a/sites/dev/package.json b/sites/dev/package.json
index 48c026857ee..38688d86fe3 100644
--- a/sites/dev/package.json
+++ b/sites/dev/package.json
@@ -16,7 +16,8 @@
"scripts": {
"build": "next build",
"cibuild": "yarn build && node scripts/algolia.mjs",
- "clean": "rimraf prebuild/* && rimraf public/locales/*/* && rimraf public/feeds/*",
+ "clean": "rimraf prebuild/* && rimraf public/locales/*/* && rimraf public/feeds/* && rimraf ../shared/prebuild/data/*",
+ "predev": "FAST=1 SITE=dev node --experimental-json-modules ../shared/prebuild/index.mjs",
"dev": "next dev -p 8000",
"develop": "next dev -p 8000",
"i18n": "SITE=dev node ../shared/prebuild/i18n-only.mjs",
diff --git a/sites/dev/pages/[...slug].mjs b/sites/dev/pages/[...slug].mjs
index a739222e282..976fa92275f 100644
--- a/sites/dev/pages/[...slug].mjs
+++ b/sites/dev/pages/[...slug].mjs
@@ -28,7 +28,7 @@ const DocsPage = ({ page, slug }) => {
import(`../../../markdown/dev/${slug}/en.md`).then((mod) => {
setFrontmatter(mod.frontmatter)
const Component = mod.default
- setMDX()
+ setMDX()
})
}
loadMDX()
diff --git a/sites/shared/components/mdx/index.mjs b/sites/shared/components/mdx/index.mjs
index 5cb3ed480ca..6ea0b0a42b2 100644
--- a/sites/shared/components/mdx/index.mjs
+++ b/sites/shared/components/mdx/index.mjs
@@ -10,34 +10,44 @@ import { ControlTip } from '../control/tip.mjs'
import { Legend } from './legend.mjs'
import { V3Wip } from '../v3-wip.mjs'
-export const components = {
- // Custom components
- Method: HttpMethod,
- StatusCode: HttpStatusCode,
- Comment: (props) => ,
- Fixme: (props) => ,
- Link: (props) => ,
- Note: (props) => ,
- ReadMore,
- Related: (props) => ,
- Tip: (props) => ,
- Warning: (props) => ,
- YouTube,
- pre: (props) => ,
- // This Figure component causes hydration errors
- //img: Figure,
- table: (props) => (
-
- ),
- Tab,
- Tabs,
- ControlTip,
- Example,
- PatternDocs: V3Wip,
- PatternOptions: V3Wip,
- PatternMeasurements: V3Wip,
- Gauge: V3Wip,
- Legend,
+export const components = (site = 'org') => {
+ const base = {
+ // Custom components
+ Comment: (props) => ,
+ Fixme: (props) => ,
+ Link: (props) => ,
+ Note: (props) => ,
+ ReadMore: (props) => ,
+ Related: (props) => ,
+ Tip: (props) => ,
+ Warning: (props) => ,
+ YouTube,
+ pre: (props) => ,
+ // This Figure component causes hydration errors
+ //img: Figure,
+ table: (props) => (
+
+ ),
+ Tab,
+ Tabs,
+ ControlTip,
+ Example,
+ }
+
+ return site === 'dev'
+ ? {
+ ...base,
+ Method: HttpMethod,
+ StatusCode: HttpStatusCode,
+ }
+ : {
+ ...base,
+ PatternDocs: V3Wip,
+ PatternOptions: V3Wip,
+ PatternMeasurements: V3Wip,
+ Gauge: V3Wip,
+ Legend,
+ }
}
diff --git a/sites/shared/components/mdx/read-more.mjs b/sites/shared/components/mdx/read-more.mjs
index 4d4141b609f..854973b7a03 100644
--- a/sites/shared/components/mdx/read-more.mjs
+++ b/sites/shared/components/mdx/read-more.mjs
@@ -3,29 +3,67 @@ import orderBy from 'lodash.orderby'
import Link from 'next/link'
import { useContext } from 'react'
import { NavigationContext } from 'shared/context/navigation-context.mjs'
+import { useNavigation } from 'site/hooks/use-navigation.mjs'
+
+const baseClasses =
+ 'text-base-content no-underline inline-block hover:text-secondary hover:underline'
+const classes = [
+ `text-3xl font-bold py-2 ${baseClasses} list-disc`,
+ `text-2xl font-bold py-1 ${baseClasses}`,
+ `text-xl font-medium ${baseClasses}`,
+ `text-lg font-medium ${baseClasses}`,
+]
+
+const getClasses = (level) => classes[level] || `text-normal font-regular ${baseClasses}`
// Helper method to filter out the real children
const order = (obj) => orderBy(obj, ['o', 't'], ['asc', 'asc'])
const currentChildren = (current) =>
Object.values(order(current)).filter((entry) => typeof entry === 'object')
-export const ReadMore = ({ app, recurse = 0 }) => {
+const getRoot = {
+ dev: (slug, nav) => {
+ if (!slug || slug === 'docs') return nav
+ if (slug.indexOf('/') === -1) return nav[slug]
+ return get(nav, slug.split('/'))
+ },
+ org: (slug, nav) => {
+ // Fixme: make this work for org
+ if (!slug || slug === 'docs') return nav
+ if (slug.indexOf('/') === -1) return nav[slug]
+ return get(nav, slug.split('/'))
+ },
+}
+
+export const ReadMore = ({
+ app,
+ recurse = 0,
+ root = false,
+ site = 'org',
+ level = 0,
+ pretty = false,
+}) => {
const { nav, slug } = useContext(NavigationContext)
+ const { siteNav } = useNavigation()
// Deal with recurse not being a number
- if (recurse) {
+ if (recurse && recurse !== true) {
if (typeof recurse === 'number') recurse--
else recurse = 1
}
- const root = slug && slug !== 'docs' ? get(nav, slug.split('/').slice(1)) : nav
+ // Deal with root being passed as true
+ if (root === true) root = ''
+ const tree = getRoot[site](root, siteNav)
const list = []
- for (const page of currentChildren(root)) {
+ for (const page of currentChildren(tree)) {
list.push(
- {page.t}
- {recurse > 0 ? : null}
+
+ {page.t}
+
+ {recurse ? : null}
)
}
diff --git a/sites/shared/components/navigation/primary.mjs b/sites/shared/components/navigation/primary.mjs
index c3bca3ca079..9d0223dddfe 100644
--- a/sites/shared/components/navigation/primary.mjs
+++ b/sites/shared/components/navigation/primary.mjs
@@ -17,6 +17,7 @@ import {
I18nIcon,
WrenchIcon,
FreeSewingIcon,
+ HeartIcon,
} from 'shared/components/icons.mjs'
import { Breadcrumbs } from 'shared/components/breadcrumbs.mjs'
@@ -25,13 +26,13 @@ export const ns = ['sections']
// List of icons matched to top-level slug
export const icons = {
// FreeSewing.dev
- developers: (className = '') => ,
- designers: (className = '') => ,
- writers: (className = '') => ,
- translators: (className = '') => ,
- infrastructure: (className = '') => ,
- teamwork: (className = '') => ,
+ api: (className = '') => ,
+ design: (className = '') => ,
+ contribute: (className = '') => ,
+ i18n: (className = '') => ,
+ infra: (className = '') => ,
about: (className = '') => ,
+ support: (className = '') => ,
// FreeSewing.org
account: (className = '') => ,
diff --git a/sites/shared/prebuild/index.mjs b/sites/shared/prebuild/index.mjs
index 9e2088c631e..4cb83912b13 100644
--- a/sites/shared/prebuild/index.mjs
+++ b/sites/shared/prebuild/index.mjs
@@ -10,15 +10,15 @@ import { prebuildDesigns } from './designs.mjs'
import { generateOgImage } from './og/index.mjs'
const run = async () => {
- const linter = process.env.LINTER ? true : false
- if (linter) return true
+ if (process.env.LINTER) return true
+ const FAST = process.env.FAST ? true : false
const SITE = process.env.SITE || 'lab'
- prebuildDesigns()
+ if (!FAST) prebuildDesigns()
if (['org', 'dev'].includes(SITE)) {
- await prebuildGitData(SITE)
+ if (!FAST) await prebuildGitData(SITE)
const docPages = await prebuildDocs(SITE)
prebuildNavigation(docPages, false, SITE)
- if (process.env.GENERATE_OG_IMAGES) {
+ if (!FAST && process.env.GENERATE_OG_IMAGES) {
// Create og image for the home page
await generateOgImage({
lang: 'en',
@@ -42,8 +42,10 @@ const run = async () => {
if (SITE === 'org') await prebuildOrg()
await prebuildI18n(SITE)
- await prebuildContributors(SITE)
- await prebuildPatrons(SITE)
+ if (!FAST) {
+ await prebuildContributors(SITE)
+ await prebuildPatrons(SITE)
+ }
console.log()
}