fix: ReadMore no longer works
This commit is contained in:
parent
69092702d9
commit
e7373375d0
16 changed files with 1988 additions and 1476 deletions
3331
package-lock.json
generated
3331
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'
|
||||
|
||||
// Hooks
|
||||
import React, { useState, useContext } from 'react'
|
||||
import React, { useState, useContext, Fragment } from 'react'
|
||||
import { useAtom } from 'jotai'
|
||||
|
||||
// Components
|
||||
|
@ -319,7 +319,7 @@ const DesignCard = ({ name, lineDrawing = false, linkTo, Link }) => {
|
|||
const Difficulty = ({ score = 0, className = '' }) => (
|
||||
<div className={`tw-flex tw-flex-row tw-items-center ${className}`}>
|
||||
{[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>
|
||||
)
|
||||
|
@ -351,6 +351,12 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
|||
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
||||
|
||||
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
|
||||
const LineDrawing = lineDrawings[design] || []
|
||||
|
@ -433,7 +439,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
|||
</div>
|
||||
<div className="">
|
||||
{optionalMeasurements[design].map((m, i) => (
|
||||
<>
|
||||
<Fragment key={m}>
|
||||
<Link
|
||||
href={`/docs/measurements/${m.toLowerCase()}`}
|
||||
key={m}
|
||||
|
@ -442,7 +448,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
|||
{measurementsTranslations[m]}
|
||||
</Link>
|
||||
{i < optionalMeasurements[design].length - 1 ? <span>, </span> : null}
|
||||
</>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
|
@ -455,7 +461,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
|||
</div>
|
||||
<div className="">
|
||||
{requiredMeasurements[design].map((m, i) => (
|
||||
<>
|
||||
<Fragment key={m}>
|
||||
<Link
|
||||
href={`/docs/measurements/${m.toLowerCase()}`}
|
||||
key={m}
|
||||
|
@ -464,7 +470,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
|||
{measurementsTranslations[m]}
|
||||
</Link>
|
||||
{i < requiredMeasurements[design].length - 1 ? <span>, </span> : null}
|
||||
</>
|
||||
</Fragment>
|
||||
))}
|
||||
</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
|
||||
---
|
||||
|
||||
<ReadMore />
|
||||
import DocCardList from '@theme/DocCardList'
|
||||
|
||||
<DocCardList />
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
title: Frequently Asked Questions
|
||||
---
|
||||
|
||||
<ReadMore recurse />
|
||||
import DocCardList from '@theme/DocCardList'
|
||||
|
||||
<DocCardList />
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
title: About FreeSewing
|
||||
---
|
||||
|
||||
<ReadMore />
|
||||
import DocCardList from '@theme/DocCardList'
|
||||
|
||||
<DocCardList />
|
||||
|
|
|
@ -2,4 +2,20 @@
|
|||
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"
|
||||
sidebar_label: Yuri Hoodie
|
||||
title: "Yuri: FreeSewing's Yuri Sweater"
|
||||
sidebar_label: Yuri Sweater
|
||||
---
|
||||
|
||||
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
||||
|
|
|
@ -2,4 +2,21 @@
|
|||
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
|
||||
---
|
||||
|
||||
<ReadMore />
|
||||
import DocCardList from '@theme/DocCardList'
|
||||
|
||||
<DocCardList />
|
||||
|
|
|
@ -37,6 +37,10 @@ const config = {
|
|||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
future: {
|
||||
experimental_faster: false, // Too many bugs for now
|
||||
},
|
||||
|
||||
/*
|
||||
* We need to make sure we can import from .mjs files
|
||||
*/
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.6.1",
|
||||
"@docusaurus/preset-classic": "^3.6.1",
|
||||
"@docusaurus/core": "^3.7.0",
|
||||
"@docusaurus/faster": "^3.7.0",
|
||||
"@docusaurus/plugin-content-blog": "^3.7.0",
|
||||
"@docusaurus/preset-classic": "^3.7.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"clsx": "^2.0.0",
|
||||
|
@ -31,8 +33,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-syntax-import-attributes": "^7.25.6",
|
||||
"@docusaurus/module-type-aliases": "^3.6.1",
|
||||
"@docusaurus/types": "^3.6.1",
|
||||
"@docusaurus/module-type-aliases": "^3.7.0",
|
||||
"@docusaurus/types": "^3.7.0",
|
||||
"glob": "^11.0.0",
|
||||
"gray-matter": "^4.0.3",
|
||||
"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">
|
||||
{examples[design].map((example) => (
|
||||
<Link
|
||||
key={example.id}
|
||||
href={`/showcase/${example.id}/`}
|
||||
title={example.title}
|
||||
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 { Legend } from './legend.mjs'
|
||||
import { MeasurementImage } from './measurement-image.mjs'
|
||||
import { ReadMore } from './readmore.js'
|
||||
import { YouTube } from './youtube.mjs'
|
||||
|
||||
const MDXComponents = {
|
||||
|
@ -48,7 +47,6 @@ const MDXComponents = {
|
|||
Example,
|
||||
Legend,
|
||||
MeasurementImage,
|
||||
ReadMore,
|
||||
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