Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Feliz.Markdown/Markdown.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ open Feliz
type IMarkdownRenderer = interface end

type ICodeProperties =
abstract isInline : bool
abstract className : string
abstract children: ReactElement []
abstract language : string
abstract value: string

type ITextProperties =
abstract children: string
Expand Down Expand Up @@ -83,9 +82,8 @@ module markdown =
static member inline code(render: ICodeProperties -> ReactElement) =
let renderInternal (props: obj) =
let inputs = createObj [
"className" ==> emitJsExpr<string> props "$0.className || \"\""
"children" ==> emitJsExpr<ReactElement []> props "$0.children || []"
"isInline" ==> emitJsExpr<bool> props "$0.inline || false"
"value" ==> emitJsExpr<string> props "$0.children || \"\""
"language" ==> emitJsExpr<string> props "$0.className || \"\""
]
render (unbox<ICodeProperties> inputs)
unbox<IComponent> (Interop.mkAttr "code" renderInternal)
Expand Down Expand Up @@ -160,4 +158,4 @@ type Markdown =
static member inline markdown (properties: IReactProperty list) =
Interop.reactApi.createElement(importDefault "react-markdown", createObj !!properties)
static member inline markdown (sourceMarkdown: string) =
Interop.reactApi.createElement(importDefault "react-markdown", createObj [ "children" ==> sourceMarkdown ])
Interop.reactApi.createElement(importDefault "react-markdown", createObj [ "children" ==> sourceMarkdown ])
3 changes: 2 additions & 1 deletion Feliz/Feliz.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<Compile Include="TransitionProperty.fs" />
<Compile Include="TransitionTimingFunction.fs" />
<Compile Include="TransformOrigin.fs" />
<Compile Include="Gradient.fs" />
<Compile Include="GridTypes.fs" />
<Compile Include="Styles.fs" />
<Compile Include="Svg.fs" />
Expand All @@ -50,4 +51,4 @@
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Include="Fable.ReactDom.Types" Version="18.2.0" />
</ItemGroup>
</Project>
</Project>
Loading