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
1abaea10
Commit
1abaea10
authored
Feb 19, 2021
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
R2: add 'here' and 'Leaf'
parent
6155a35e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+20
-5
No files found.
src/Gargantext/Utils/Reactix.purs
View file @
1abaea10
...
...
@@ -43,8 +43,21 @@ import Web.HTML (window)
import Web.HTML.Window (localStorage)
import Web.Storage.Storage (Storage, getItem, setItem)
type Module = String
type Component p = Record p -> Array R.Element -> R.Element
type Leaf p = Record p -> R.Element
type Here =
{ component :: forall p. String -> R.HooksComponent p -> R.Component p
, log :: forall l. l -> Effect Unit }
here :: Module -> Here
here mod =
{ component: R.hooksComponentWithModule mod
, log: log2 ("[" <> mod <> "]") }
-- newtypes
type NTHooksComponent props = props -> Array R.Element -> R.Hooks R.Element
newtype NTComponent p = NTComponent (EffectFn1 p R.Element)
...
...
@@ -53,7 +66,8 @@ class NTIsComponent component (props :: Type) children
| component -> props, component -> children where
ntCreateElement :: component -> props -> children -> R.Element
instance componentIsNTComponent :: NTIsComponent (NTComponent props) props (Array R.Element) where
instance componentIsNTComponent
:: NTIsComponent (NTComponent props) props (Array R.Element) where
ntCreateElement = R.rawCreateElement
-- | Turns a `HooksComponent` function into a Component
...
...
@@ -63,15 +77,16 @@ ntHooksComponent name c = NTComponent $ named name $ mkEffectFn1 c'
c' :: props -> Effect R.Element
c' props = R.runHooks $ c props (children props)
ntHooksComponentWithModule :: forall props. Module -> String -> NTHooksComponent props -> NTComponent props
ntHooksComponentWithModule module' name c = ntHooksComponent (module' <> "." <> name) c
ntHooksComponentWithModule
:: forall props. Module -> String -> NTHooksComponent props -> NTComponent props
ntHooksComponentWithModule module' name c =
ntHooksComponent (module' <> "." <> name) c
---------------------------
-- TODO Copied from reactix, export these:
children :: forall a. a -> Array R.Element
children a = react .. "Children" ... "toArray" $ [ (a .. "children") ]
type Module = String
---------------------------
newtype Point = Point { x :: Number, y :: Number }
...
...
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