dashboard-rss/src/Client/Imports.fs

42 lines
1.3 KiB
Forth

module Imports
open Fable.Core
open Fable.Helpers.React
open Fable.Import.React
open Fable.Core.JsInterop
[<Import("default", from="sanitize-html")>]
let sanitize (s : string) : string = jsNative
type SpinnerProps =
| Color of string
| Loading of bool
let inline loadingSpinner (props : SpinnerProps list) (elems : ReactElement list) : ReactElement =
ofImport "ClimbingBoxLoader" "react-spinners" (keyValueList CaseRules.LowerFirst props) elems
module Funny =
[<Import("default", from="funnies")>]
let _funnies () = jsNative
let funny = createNew _funnies ()
[<Emit("$0.message()")>]
let _message (funny : obj) : string = jsNative
let message () = funny |> _message
module Fuse =
// Bindings for "Fuse.js" fuzzy search (see its docs) - very barebones
type Option =
| Keys of string array
type Fuse<'a> = CantDefineOpaqueTypesForJs of unit
[<Import("default", from="fuse.js")>]
let _fuse (data : 'a array) (conf : obj) : 'a Fuse = jsNative
// Creates a new Fuse object
let make (data : 'a array) (conf : Option list) : 'a Fuse = createNew _fuse (data, (keyValueList CaseRules.LowerFirst conf)) :?> 'a Fuse
// Allows you to search using a Fuse object
[<Emit("$0.search($1)")>]
let search (fuse : 'a Fuse) (query : string) = jsNative