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
Show 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 @@
...
@@ -3,10 +3,11 @@
-- Select a backend and log into it
-- Select a backend and log into it
module Gargantext.Components.Login where
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.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import DOM.Simple.Console (log)
import Effect (Effect)
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
...
@@ -30,7 +31,7 @@ type Props =
...
@@ -30,7 +31,7 @@ type Props =
, sessions :: R2.Reductor Sessions Sessions.Action
, sessions :: R2.Reductor Sessions Sessions.Action
, visible :: R.State Boolean )
, visible :: R.State Boolean )
type ModalProps = ( visible :: Boolean )
type ModalProps = ( visible ::
R.State
Boolean )
modal :: Record ModalProps -> R.Element -> R.Element
modal :: Record ModalProps -> R.Element -> R.Element
modal props child = R.createElement modalCpt props [ child ]
modal props child = R.createElement modalCpt props [ child ]
...
@@ -40,8 +41,9 @@ modalCpt = R.hooksComponent "Modal" cpt where
...
@@ -40,8 +41,9 @@ modalCpt = R.hooksComponent "Modal" cpt where
cpt {visible} children = do
cpt {visible} children = do
R.createPortal elems <$> R2.getPortalHost
R.createPortal elems <$> R2.getPortalHost
where
where
click _ = log "click!" *> (snd visible) (const false)
elems =
elems =
[ H.div { id: "loginModal", className: modalClass
visible
[ H.div { id: "loginModal", className: modalClass
(fst visible)
, role: "dialog", "data": {show: true}, style: {display: "block"}}
, role: "dialog", "data": {show: true}, style: {display: "block"}}
[ H.div { className: "modal-dialog", role: "document"}
[ H.div { className: "modal-dialog", role: "document"}
[ H.div { className: "modal-content" }
[ H.div { className: "modal-content" }
...
@@ -49,10 +51,11 @@ modalCpt = R.hooksComponent "Modal" cpt where
...
@@ -49,10 +51,11 @@ modalCpt = R.hooksComponent "Modal" cpt where
[ H.h5 { className: "modal-title" } []
[ H.h5 { className: "modal-title" } []
, H.button { "type": "button", className: "close"
, H.button { "type": "button", className: "close"
, "data": { dismiss: "modal" } }
, "data": { dismiss: "modal" } }
[ H.span {
aria: { hidden: true
} } [ H.text "X" ] ] ]
[ H.span {
on: {click
} } [ H.text "X" ] ] ]
, H.div { className: "modal-body" } children ] ] ] ]
, H.div { className: "modal-body" } children ] ] ] ]
modalClass s = "modal myModal" <> if s then "" else " fade"
modalClass s = "modal myModal" <> if s then "" else " fade"
login :: Record Props -> R.Element
login :: Record Props -> R.Element
login props = R.createElement loginCpt props []
login props = R.createElement loginCpt props []
...
@@ -62,7 +65,7 @@ loginCpt = R.hooksComponent "G.C.Login.login" cpt
...
@@ -62,7 +65,7 @@ loginCpt = R.hooksComponent "G.C.Login.login" cpt
cpt props@{backends, sessions, visible} _ = do
cpt props@{backends, sessions, visible} _ = do
backend <- R.useState' Nothing
backend <- R.useState' Nothing
pure $
pure $
modal {visible
: fst visible
} $
modal {visible} $
case fst backend of
case fst backend of
Nothing -> chooser { backends, backend, sessions, visible }
Nothing -> chooser { backends, backend, sessions, visible }
Just b -> form { sessions, visible, backend: b }
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