Create providers directory; Markdown provider

This commit is contained in:
Kyle Shockey
2017-05-18 17:03:58 -07:00
parent 60934107d3
commit 3b62a93bb6
4 changed files with 19 additions and 3 deletions

View File

@@ -1,13 +1,10 @@
import React, { PropTypes } from "react"
import OriCollapse from "react-collapse"
import _Markdown from "react-remarkable"
function xclass(...args) {
return args.filter(a => !!a).join(" ").trim()
}
export const Markdown = _Markdown
export class Container extends React.Component {
render() {
let { fullscreen, full, ...rest } = this.props

View File

@@ -0,0 +1,10 @@
import Remarkable from "react-remarkable"
import React from "react"
export default ({ source }) => {
return <Remarkable
options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
source={source}
></Remarkable>
}

View File

@@ -0,0 +1,6 @@
# Providers
Providers are generic bridges to third-party components. They provide two benefits:
1. ability for plugins to override third-party components, because providers are loaded through `getComponent`
2. allows us to avoid painting ourselves into a corner with a third-party component

View File

@@ -46,6 +46,8 @@ import Model from "core/components/model"
import Models from "core/components/models"
import TryItOutButton from "core/components/try-it-out-button"
import Markdown from "core/components/providers/markdown"
import BaseLayout from "core/components/layouts/base"
import * as LayoutUtils from "core/components/layout-utils"
@@ -89,6 +91,7 @@ export default function() {
model: Model,
models: Models,
TryItOutButton,
Markdown,
BaseLayout
}
}