LoadingSpinner.purs 1 KB
Newer Older
James Laver's avatar
James Laver committed
1 2
module Gargantext.Components.LoadingSpinner where

3
import Data.Maybe (Maybe(..), fromMaybe)
James Laver's avatar
James Laver committed
4 5 6
import Reactix as R
import Reactix.DOM.HTML as H

7 8 9 10 11 12
import Gargantext.Prelude

import Gargantext.Utils.Reactix as R2

here :: R2.Here
here = R2.here "Gargantext.Components.LoadingSpinner"
13

14 15 16
type Props =
  ( additionalClass :: Maybe String  -- addtional classes for styling the spinner
  )
James Laver's avatar
James Laver committed
17 18 19 20 21

loadingSpinner :: Record Props -> R.Element
loadingSpinner props = R.createElement loadingSpinnerCpt props []

loadingSpinnerCpt :: R.Component Props
22
loadingSpinnerCpt = here.component "LoadingSpinner" cpt
James Laver's avatar
James Laver committed
23
  where
24
    -- cpt _ _ = H.i {className: "spinner fa fa-smile-o fa-spin fa-3x fa-fw"} [H.text ""]
25 26 27
    -- cpt _ _ = H.i {className: "fa fa-globe fa-spin fa-3x fa-fw"} [H.text ""]

    -- cpt _ _ = H.i {className: "fa fa-circle-o-notch fa-spin fa-3x fa-fw"} [H.text ""]
28 29 30 31
    cpt { additionalClass } _ = do
      pure $ H.i { className: "fa fa-spinner fa-pulse fa-3x fa-fw " <> c } [H.text ""]
      where
        c = fromMaybe "" additionalClass