wip(fs.dev): Work on mdx components
This commit is contained in:
parent
1b888f02f1
commit
18566b5d37
10 changed files with 78 additions and 60 deletions
|
@ -0,0 +1,8 @@
|
|||
import { list as designs } from '@freesewing/pattern-info'
|
||||
|
||||
const DesignIterator = props => {
|
||||
const Component = props.component
|
||||
return designs.map(design => <Component design={design} />)
|
||||
}
|
||||
|
||||
export default DesignIterator
|
4
packages/freesewing.shared/components/mdx/example.js
Normal file
4
packages/freesewing.shared/components/mdx/example.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
const Example = props => <p>FIXME: Example still todo</p>
|
||||
|
||||
export const Example
|
||||
|
8
packages/freesewing.shared/components/mdx/figure.js
Normal file
8
packages/freesewing.shared/components/mdx/figure.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const Figure = props => (
|
||||
<figure>
|
||||
<img src={props?.src} alt={props?.alt || ''} title={props?.title || ''} className="shadow-md"/>
|
||||
<figcaption className="text-center italic">{props.title || 'FIXME: No title property set on this image'}</figcaption>
|
||||
</figure>
|
||||
)
|
||||
|
||||
export default Figure
|
30
packages/freesewing.shared/components/mdx/index.js
Normal file
30
packages/freesewing.shared/components/mdx/index.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
import Popout from '../popout.js'
|
||||
import Highlight from './highlight.js'
|
||||
import YouTube from './youtube.js'
|
||||
import DesignIterator from './design-iterator.js'
|
||||
import Figure from './figure.js'
|
||||
import Example from './example.js'
|
||||
import ReadMore from './read-more.js'
|
||||
|
||||
|
||||
const mdxCustomComponents = {
|
||||
// Custom components
|
||||
DesignIterator,
|
||||
Example,
|
||||
Fixme: props => <Popout {...props} fixme />,
|
||||
Link: props => <Popout {...props} link />,
|
||||
Note: props => <Popout {...props} note />,
|
||||
ReadMore,
|
||||
Related: props => <Popout {...props} related />,
|
||||
Tip: props => <Popout {...props} tip />,
|
||||
Warning: props => <Popout {...props} warning />,
|
||||
YouTube,
|
||||
// Tailwind typography plugin overrides
|
||||
h5: props => <h5 className="font-bold my-2">{props.children}</h5>,
|
||||
h6: props => <h6 className="font-bold my-2 text-sm">{props.children}</h6>,
|
||||
pre: props => <Highlight {...props} />,
|
||||
//code: props => <Highlight {...props} tag='code'/>,
|
||||
}
|
||||
|
||||
export default mdxCustomComponents
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Generates a ReadMore block
|
||||
export const ReadMore = props => (
|
||||
<blockquote>
|
||||
<h5>Read More</h5>
|
||||
{props.children}
|
||||
</blockquote>
|
||||
)
|
||||
|
||||
export const Note = props => (
|
||||
<blockquote classname={` `}>
|
||||
<h5>Note</h5>
|
||||
{props.children}
|
||||
</blockquote>
|
||||
)
|
||||
export const Tip = () => <p>Tip</p>
|
||||
export const Example = () => <p>Example</p>
|
||||
|
4
packages/freesewing.shared/components/mdx/read-more.js
Normal file
4
packages/freesewing.shared/components/mdx/read-more.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
const ReadMore = props => <p>FIXME: Example still todo</p>
|
||||
|
||||
export default ReadMore
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue