fix: ReadMore no longer works
This commit is contained in:
parent
69092702d9
commit
e7373375d0
16 changed files with 1988 additions and 1476 deletions
3335
package-lock.json
generated
3335
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@ import { LoadingStatusContext } from '@freesewing/react/context/LoadingStatus'
|
||||||
import { ModalContext } from '@freesewing/react/context/Modal'
|
import { ModalContext } from '@freesewing/react/context/Modal'
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
import React, { useState, useContext } from 'react'
|
import React, { useState, useContext, Fragment } from 'react'
|
||||||
import { useAtom } from 'jotai'
|
import { useAtom } from 'jotai'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
|
@ -319,7 +319,7 @@ const DesignCard = ({ name, lineDrawing = false, linkTo, Link }) => {
|
||||||
const Difficulty = ({ score = 0, className = '' }) => (
|
const Difficulty = ({ score = 0, className = '' }) => (
|
||||||
<div className={`tw-flex tw-flex-row tw-items-center ${className}`}>
|
<div className={`tw-flex tw-flex-row tw-items-center ${className}`}>
|
||||||
{[0, 1, 2, 3, 4].map((i) => (
|
{[0, 1, 2, 3, 4].map((i) => (
|
||||||
<CircleIcon fill={i < score ? true : false} className={`tw-w-4 tw-h-4`} />
|
<CircleIcon key={i} fill={i < score ? true : false} className={`tw-w-4 tw-h-4`} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -351,6 +351,12 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
||||||
|
|
||||||
if (!design) return null
|
if (!design) return null
|
||||||
|
if (['teagan', 'trayvon'].includes(design))
|
||||||
|
return (
|
||||||
|
<p>
|
||||||
|
We are not rendering the design info for {design} because of a bug we are still working on.
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
|
||||||
// Line drawings
|
// Line drawings
|
||||||
const LineDrawing = lineDrawings[design] || []
|
const LineDrawing = lineDrawings[design] || []
|
||||||
|
@ -433,7 +439,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div className="">
|
||||||
{optionalMeasurements[design].map((m, i) => (
|
{optionalMeasurements[design].map((m, i) => (
|
||||||
<>
|
<Fragment key={m}>
|
||||||
<Link
|
<Link
|
||||||
href={`/docs/measurements/${m.toLowerCase()}`}
|
href={`/docs/measurements/${m.toLowerCase()}`}
|
||||||
key={m}
|
key={m}
|
||||||
|
@ -442,7 +448,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
{measurementsTranslations[m]}
|
{measurementsTranslations[m]}
|
||||||
</Link>
|
</Link>
|
||||||
{i < optionalMeasurements[design].length - 1 ? <span>, </span> : null}
|
{i < optionalMeasurements[design].length - 1 ? <span>, </span> : null}
|
||||||
</>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
@ -455,7 +461,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div className="">
|
||||||
{requiredMeasurements[design].map((m, i) => (
|
{requiredMeasurements[design].map((m, i) => (
|
||||||
<>
|
<Fragment key={m}>
|
||||||
<Link
|
<Link
|
||||||
href={`/docs/measurements/${m.toLowerCase()}`}
|
href={`/docs/measurements/${m.toLowerCase()}`}
|
||||||
key={m}
|
key={m}
|
||||||
|
@ -464,7 +470,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
{measurementsTranslations[m]}
|
{measurementsTranslations[m]}
|
||||||
</Link>
|
</Link>
|
||||||
{i < requiredMeasurements[design].length - 1 ? <span>, </span> : null}
|
{i < requiredMeasurements[design].length - 1 ? <span>, </span> : null}
|
||||||
</>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
|
||||||
plugins: ['@babel/plugin-syntax-import-attributes'],
|
|
||||||
}
|
|
7
sites/org/babel.config.mjs
Normal file
7
sites/org/babel.config.mjs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import docusaurusPreset from '@docusaurus/core/lib/babel/preset.js'
|
||||||
|
import importAttributesPlugin from '@babel/plugin-syntax-import-attributes'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
presets: [docusaurusPreset],
|
||||||
|
plugins: [importAttributesPlugin],
|
||||||
|
}
|
|
@ -2,4 +2,6 @@
|
||||||
title: Newsletter
|
title: Newsletter
|
||||||
---
|
---
|
||||||
|
|
||||||
<ReadMore />
|
import DocCardList from '@theme/DocCardList'
|
||||||
|
|
||||||
|
<DocCardList />
|
||||||
|
|
|
@ -2,4 +2,6 @@
|
||||||
title: Frequently Asked Questions
|
title: Frequently Asked Questions
|
||||||
---
|
---
|
||||||
|
|
||||||
<ReadMore recurse />
|
import DocCardList from '@theme/DocCardList'
|
||||||
|
|
||||||
|
<DocCardList />
|
||||||
|
|
|
@ -2,4 +2,6 @@
|
||||||
title: About FreeSewing
|
title: About FreeSewing
|
||||||
---
|
---
|
||||||
|
|
||||||
<ReadMore />
|
import DocCardList from '@theme/DocCardList'
|
||||||
|
|
||||||
|
<DocCardList />
|
||||||
|
|
|
@ -2,4 +2,20 @@
|
||||||
title: FreeSewing Designs
|
title: FreeSewing Designs
|
||||||
---
|
---
|
||||||
|
|
||||||
<ReadMore />
|
import { collection, about } from '@freesewing/collection'
|
||||||
|
import Link from '@docusaurus/Link'
|
||||||
|
|
||||||
|
Documentation for all designs in the FreeSewing collection:
|
||||||
|
|
||||||
|
<ul className="tw-list-disc">
|
||||||
|
{collection.map((design) => (
|
||||||
|
<li key={design} className="tw-list-disc">
|
||||||
|
<Link
|
||||||
|
href={`/docs/designs/${design}`}
|
||||||
|
className="tw-capitalize tw-font-medium tw-underline tw-decoration-2 hover:tw-decoration-4"
|
||||||
|
>
|
||||||
|
{about[design].name}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: "Tiberius: FreeSewing's Yuri Hoodie"
|
title: "Yuri: FreeSewing's Yuri Sweater"
|
||||||
sidebar_label: Yuri Hoodie
|
sidebar_label: Yuri Sweater
|
||||||
---
|
---
|
||||||
|
|
||||||
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
||||||
|
|
|
@ -2,4 +2,21 @@
|
||||||
title: Measurements we use
|
title: Measurements we use
|
||||||
---
|
---
|
||||||
|
|
||||||
<ReadMore />
|
import { measurements } from '@freesewing/config'
|
||||||
|
import { measurements as translations } from '@freesewing/i18n'
|
||||||
|
import Link from '@docusaurus/Link'
|
||||||
|
|
||||||
|
Documentation for all measurements used by FreeSewing designs:
|
||||||
|
|
||||||
|
<ul className="tw-list-disc">
|
||||||
|
{measurements.map((m) => (
|
||||||
|
<li key={m} className="tw-list-disc">
|
||||||
|
<Link
|
||||||
|
href={`/docs/measurements/${m.toLowerCase()}`}
|
||||||
|
className="tw-capitalize tw-font-medium tw-underline tw-decoration-2 hover:tw-decoration-4"
|
||||||
|
>
|
||||||
|
{translations[m]}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
|
|
@ -2,4 +2,6 @@
|
||||||
title: Sewing Terminology
|
title: Sewing Terminology
|
||||||
---
|
---
|
||||||
|
|
||||||
<ReadMore />
|
import DocCardList from '@theme/DocCardList'
|
||||||
|
|
||||||
|
<DocCardList />
|
||||||
|
|
|
@ -37,6 +37,10 @@ const config = {
|
||||||
onBrokenLinks: 'throw',
|
onBrokenLinks: 'throw',
|
||||||
onBrokenMarkdownLinks: 'warn',
|
onBrokenMarkdownLinks: 'warn',
|
||||||
|
|
||||||
|
future: {
|
||||||
|
experimental_faster: false, // Too many bugs for now
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to make sure we can import from .mjs files
|
* We need to make sure we can import from .mjs files
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
"write-heading-ids": "docusaurus write-heading-ids"
|
"write-heading-ids": "docusaurus write-heading-ids"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "^3.6.1",
|
"@docusaurus/core": "^3.7.0",
|
||||||
"@docusaurus/preset-classic": "^3.6.1",
|
"@docusaurus/faster": "^3.7.0",
|
||||||
|
"@docusaurus/plugin-content-blog": "^3.7.0",
|
||||||
|
"@docusaurus/preset-classic": "^3.7.0",
|
||||||
"@mdx-js/react": "^3.0.0",
|
"@mdx-js/react": "^3.0.0",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
|
@ -31,8 +33,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-syntax-import-attributes": "^7.25.6",
|
"@babel/plugin-syntax-import-attributes": "^7.25.6",
|
||||||
"@docusaurus/module-type-aliases": "^3.6.1",
|
"@docusaurus/module-type-aliases": "^3.7.0",
|
||||||
"@docusaurus/types": "^3.6.1",
|
"@docusaurus/types": "^3.7.0",
|
||||||
"glob": "^11.0.0",
|
"glob": "^11.0.0",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"yaml-loader": "^0.8.1"
|
"yaml-loader": "^0.8.1"
|
||||||
|
|
|
@ -17,6 +17,7 @@ function DesignExamples({ design }) {
|
||||||
<div className="tw-grid tw-grid-cols-2 tw-gap-2 md:tw-grid-cols-3 2xl:tw-grid-cols-4">
|
<div className="tw-grid tw-grid-cols-2 tw-gap-2 md:tw-grid-cols-3 2xl:tw-grid-cols-4">
|
||||||
{examples[design].map((example) => (
|
{examples[design].map((example) => (
|
||||||
<Link
|
<Link
|
||||||
|
key={example.id}
|
||||||
href={`/showcase/${example.id}/`}
|
href={`/showcase/${example.id}/`}
|
||||||
title={example.title}
|
title={example.title}
|
||||||
className="tw-w-full tw-aspect-square tw-rounded-lg tw-shadow"
|
className="tw-w-full tw-aspect-square tw-rounded-lg tw-shadow"
|
||||||
|
|
|
@ -19,7 +19,6 @@ import TabItem from '@theme/TabItem'
|
||||||
import { Example } from './example.mjs'
|
import { Example } from './example.mjs'
|
||||||
import { Legend } from './legend.mjs'
|
import { Legend } from './legend.mjs'
|
||||||
import { MeasurementImage } from './measurement-image.mjs'
|
import { MeasurementImage } from './measurement-image.mjs'
|
||||||
import { ReadMore } from './readmore.js'
|
|
||||||
import { YouTube } from './youtube.mjs'
|
import { YouTube } from './youtube.mjs'
|
||||||
|
|
||||||
const MDXComponents = {
|
const MDXComponents = {
|
||||||
|
@ -48,7 +47,6 @@ const MDXComponents = {
|
||||||
Example,
|
Example,
|
||||||
Legend,
|
Legend,
|
||||||
MeasurementImage,
|
MeasurementImage,
|
||||||
ReadMore,
|
|
||||||
YouTube,
|
YouTube,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
import DocCardList from '@theme/DocCardList'
|
|
||||||
import { useCurrentSidebarCategory } from '@docusaurus/theme-common'
|
|
||||||
import Link from '@docusaurus/Link'
|
|
||||||
|
|
||||||
export const ReadMore = ({ cards = false }) =>
|
|
||||||
cards ? (
|
|
||||||
<DocCardList items={useCurrentSidebarCategory().items} />
|
|
||||||
) : (
|
|
||||||
<DocList items={useCurrentSidebarCategory().items} />
|
|
||||||
)
|
|
||||||
|
|
||||||
const DocList = ({ items }) => {
|
|
||||||
const links = []
|
|
||||||
for (const item of items) {
|
|
||||||
if (['link', 'category'].includes(item.type)) {
|
|
||||||
links.push(
|
|
||||||
<li key={item.docId}>
|
|
||||||
<Link href={item.href}>{item.label}</Link>
|
|
||||||
</li>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return <ul>{links}</ul>
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue