// @flow
// @jsx glam
import glam from 'glam'
import React, { type Node } from 'react'
import SyntaxHighlighter, { registerLanguage } from 'react-syntax-highlighter/prism-light'
import typescript from 'react-syntax-highlighter/languages/prism/typescript'
import { coy } from 'react-syntax-highlighter/styles/prism'
import { colors } from './theme'
registerLanguage('typescript', typescript)
type Props = {
defaultValue: any,
description: any,
isRequired: boolean,
name: string,
type: string,
typeDefinition: string,
}
const TypeDefinition = ({ children }: { children: Node }) => {
return (
)
const HeadingRequired = props => (
)
const code = {
borderRadius: 3,
color: colors.N100,
fontFamily: 'Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace',
margin: 0,
padding: '0.2em 0.4em',
whiteSpace: 'nowrap',
}
const HeadingType = props => (
)
const HeadingName = props => (
)
const PrettyProps = (props: Props) => {
let typeName = props.type
if (typeName === 'union') {
typeName = 'union'
}
const defaultValue = props.defaultValue ? props.defaultValue : null
const description = typeof props.description === 'string' ? {props.description}
: props.description return (
{props.name}
{typeName}
{defaultValue && = {defaultValue} }
{props.isRequired ? required : null}