feat(lab): Draft view pretty ok now
This commit is contained in:
parent
73163f5676
commit
929822b249
15 changed files with 327 additions and 29 deletions
19
packages/freesewing.shared/components/yaml.js
Normal file
19
packages/freesewing.shared/components/yaml.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
import React from 'react'
|
||||
import Highlight from 'shared/components/mdx/highlight.js'
|
||||
import hljs from 'highlight.js/lib/common'
|
||||
|
||||
import yaml from 'js-yaml'
|
||||
const Yaml = props => {
|
||||
let code
|
||||
if (props.json) code = yaml.dump(JSON.parse(props.json))
|
||||
else if (props.js) code = yaml.dump(props.js)
|
||||
else code = props.children
|
||||
|
||||
return <Highlight
|
||||
language='yaml'
|
||||
raw={hljs.highlight(code, { language: 'yaml' }).value}
|
||||
/>
|
||||
}
|
||||
|
||||
export default Yaml
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue