Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
50dfb748
Commit
50dfb748
authored
Sep 30, 2019
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable closing login modal
parent
c40f5953
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Login.purs
src/Gargantext/Components/Login.purs
+8
-5
No files found.
src/Gargantext/Components/Login.purs
View file @
50dfb748
...
...
@@ -3,10 +3,11 @@
-- Select a backend and log into it
module Gargantext.Components.Login where
import Prelude (Unit, bind, const, discard, pure, flip, show, ($), (<>), (<$>))
import Prelude (Unit, bind, const, discard, pure, flip, show, ($), (<>), (
*>), (
<$>))
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import DOM.Simple.Console (log)
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Aff (launchAff_)
...
...
@@ -30,7 +31,7 @@ type Props =
, sessions :: R2.Reductor Sessions Sessions.Action
, visible :: R.State Boolean )
type ModalProps = ( visible :: Boolean )
type ModalProps = ( visible ::
R.State
Boolean )
modal :: Record ModalProps -> R.Element -> R.Element
modal props child = R.createElement modalCpt props [ child ]
...
...
@@ -40,8 +41,9 @@ modalCpt = R.hooksComponent "Modal" cpt where
cpt {visible} children = do
R.createPortal elems <$> R2.getPortalHost
where
click _ = log "click!" *> (snd visible) (const false)
elems =
[ H.div { id: "loginModal", className: modalClass
visible
[ H.div { id: "loginModal", className: modalClass
(fst visible)
, role: "dialog", "data": {show: true}, style: {display: "block"}}
[ H.div { className: "modal-dialog", role: "document"}
[ H.div { className: "modal-content" }
...
...
@@ -49,9 +51,10 @@ modalCpt = R.hooksComponent "Modal" cpt where
[ H.h5 { className: "modal-title" } []
, H.button { "type": "button", className: "close"
, "data": { dismiss: "modal" } }
[ H.span {
aria: { hidden: true
} } [ H.text "X" ] ] ]
[ H.span {
on: {click
} } [ H.text "X" ] ] ]
, H.div { className: "modal-body" } children ] ] ] ]
modalClass s = "modal myModal" <> if s then "" else " fade"
login :: Record Props -> R.Element
login props = R.createElement loginCpt props []
...
...
@@ -62,7 +65,7 @@ loginCpt = R.hooksComponent "G.C.Login.login" cpt
cpt props@{backends, sessions, visible} _ = do
backend <- R.useState' Nothing
pure $
modal {visible
: fst visible
} $
modal {visible} $
case fst backend of
Nothing -> chooser { backends, backend, sessions, visible }
Just b -> form { sessions, visible, backend: b }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment