diff --git a/config/changelog.yaml b/config/changelog.yaml index b4bf1bbe189..1f379bd6465 100644 --- a/config/changelog.yaml +++ b/config/changelog.yaml @@ -1,6 +1,11 @@ 2.16.3: date: Unreleased + Changed: + components: + - Caption should not be passed as children to Legend and Example components + See https://github.com/freesewing/freesewing/issues/1043 + Fixed: charlie: - Add `@freesewing/plugin-mirror` as peer dependency diff --git a/packages/components/src/Example/index.js b/packages/components/src/Example/index.js index d1251e7663f..7c0e849cac0 100644 --- a/packages/components/src/Example/index.js +++ b/packages/components/src/Example/index.js @@ -29,6 +29,7 @@ const Example = ({ pattern = 'examples', design = true, caption = '', + children=null, options = {}, settings, part = '', @@ -37,6 +38,8 @@ const Example = ({ const [designMode, setDesignMode] = useState(false) const [focus, setFocus] = useState(null) + if (caption) console.log('Passing the caption prop to @freesewing/components/Legend is deprecated. See: https://github.com/freesewing/freesewing/issues/1043') + const raiseEvent = (type, data) => { if (type === 'clearFocusAll') return setFocus(null) let f = {} @@ -98,7 +101,7 @@ const Example = ({ -
{caption}
+
{caption || children}
{designMode && (
{ +const Legend = ({ caption = false, part = '', children=null }) => { const patternProps = new LegendPattern({ only: part, measurements: { @@ -12,12 +12,14 @@ const Legend = ({ caption = '', part = '' }) => { .draft() .getRenderProps() + if (caption) console.log('Passing the caption prop to @freesewing/components/Legend is deprecated. See: https://github.com/freesewing/freesewing/issues/1043') + return (
-
{caption}
+
{caption || children}
) }