1
0
Fork 0
freesewing/packages/freesewing.shared/components/workbench/draft/path/index.js

19 lines
505 B
JavaScript
Raw Normal View History

2022-01-25 11:22:09 +01:00
import TextOnPath from '../text-on-path'
import { getProps } from '../utils'
2022-01-28 19:55:32 +01:00
const Path = props => {
const { path, part, name } = props
if (!path.render) return null
2022-01-25 11:22:09 +01:00
const output = []
2022-01-28 19:55:32 +01:00
const pathId = 'path-' + part + '-' + name
2022-01-25 11:22:09 +01:00
output.push(
2022-01-28 19:55:32 +01:00
<path id={pathId} key={pathId} d={path.asPathstring()} {...getProps(path)} />
2022-01-25 11:22:09 +01:00
)
2022-01-28 19:55:32 +01:00
if (path.attributes.get('data-text'))
output.push(<TextOnPath key={'text-on-path-' + name} pathId={pathId} {...props} />)
2022-01-25 11:22:09 +01:00
return output
}
export default Path