1
0
Fork 0

chore(markdown): Working on v3 docs

This commit is contained in:
Joost De Cock 2022-09-20 18:09:28 +02:00
parent 22680fbddc
commit 1f7ba79f81
17 changed files with 433 additions and 272 deletions

View file

@ -2,8 +2,8 @@
title: Pattern.getRenderProps()
---
A pattern's `getRenderProps()` method will return a set of properties
that allow the pattern to be rendered be an external renderer such as
The `Pattern.getRenderProps()` method will return an object that
facilitates rendered the pattern by an external renderer such as
a React component. It should only be called after calling `Pattern.draft()`.
## Pattern.getRenderProps() signature
@ -12,35 +12,31 @@ a React component. It should only be called after calling `Pattern.draft()`.
Object pattern.getRenderProps()
```
The object returned by this method contains the following properties:
## Pattern.getRenderProps() example
```js
import { Aaron } from "@freesewing/aaron"
import { cisFemaleAdult34 } from "@freesewing/models"
const pattern = new Aaron({
measurements: cisFemaleAdult34
})
const props = pattern.draft().getRenderProps()
```
## Pattern.getRenderProps() returned object
The `Pattern.getRenderProps()` method returns an object with
the following properties:
| Property | Description |
| --------:| ----------- |
| `autoLayout` | An object describing the (automated) pattern layout |
| `height` | Height of the drafted pattern in `mm` |
| `logs` | The logs generated by the pattern |
| `parts` | A plain object holding the drafted parts |
| `settings` | The (sets of) settings used to draft the pattern |
| `stacks` | A plain object holding the drafted stacks |
| `svg` | An [Svg Object](/reference/api/svg/) object with the `preRender` hook applied |
| `width` | Widht of the drafted pattern in `mm` |
| `height` | Height of the drafted pattern in `mm` |
| `settings` | The settings used to draft the pattern |
| `events` | An object with properties `debug`, `info`, `warning`, and `error` holding events of that type that were generated during the draft of the pattern |
| `parts` | A plain object holding the drafted parts |
<Tip>
See [the Draft React component](/reference/packages/components/draft/) for more info.
</Tip>
## Pattern.getRenderProps() example
```jsx
import React from 'react
import Aaron from "@freesewing/aaron"
import Draft from "@freesewing/components/Draft"
const MyReactComponent = ({ measurements }) => {
const pattern = new Aaron({ measurements })
return <Draft {...pattern.draft().getRenderProps()} />
}
export default MyReactComponent
```