2023-05-19 11:46:17 +02:00
|
|
|
import { Legend as LegendDesign } from '@freesewing/legend'
|
2023-06-17 13:28:17 +02:00
|
|
|
import { TabbedExample as Example } from './tabbed-example.mjs'
|
2023-05-19 11:46:17 +02:00
|
|
|
|
|
|
|
export const Legend = ({ caption = false, part = '', children = null }) => {
|
|
|
|
const settings = {
|
|
|
|
only: [`legend.${part}`],
|
|
|
|
measurements: {
|
|
|
|
head: 370,
|
|
|
|
},
|
|
|
|
}
|
2023-07-17 11:40:45 -05:00
|
|
|
const pattern = new LegendDesign(settings).draft()
|
|
|
|
|
|
|
|
const patternProps = {
|
|
|
|
renderProps: pattern.getRenderProps(),
|
|
|
|
logs: pattern.getLogs(),
|
|
|
|
}
|
|
|
|
|
2023-05-19 11:46:17 +02:00
|
|
|
if (caption)
|
|
|
|
console.log(
|
|
|
|
'Passing the caption prop to @freesewing/components/Legend is deprecated. See: https://github.com/freesewing/freesewing/issues/1043'
|
|
|
|
)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<figure>
|
|
|
|
<div className="shadow">
|
|
|
|
<Example {...{ patternProps, settings }} />
|
|
|
|
</div>
|
|
|
|
<figcaption className="text-center italic -mt-1">{caption || children}</figcaption>
|
|
|
|
</figure>
|
|
|
|
)
|
|
|
|
}
|