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
21b8ae83
Commit
21b8ae83
authored
Mar 12, 2018
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree integrated with the docview and open close icons also done
parent
f36312b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
13 deletions
+62
-13
index.html
dist/index.html
+40
-0
DocView.purs
src/DocView.purs
+22
-13
No files found.
dist/index.html
View file @
21b8ae83
...
...
@@ -10,6 +10,46 @@
<!-- <link href="css/lavish-bootstrap.css" rel="stylesheet"> -->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/menu.css"
/>
<link
href=
"css/Login.css"
rel=
"stylesheet"
>
<style>
*
{
margin
:
0
;
padding
:
0
;
list-style
:
none
;}
ul
li
{
margin-left
:
15px
;
position
:
relative
;
padding-left
:
5px
;
}
ul
li
::before
{
content
:
" "
;
position
:
absolute
;
width
:
1px
;
background-color
:
#000
;
top
:
5px
;
bottom
:
-12px
;
left
:
-10px
;
}
body
>
ul
>
li
:first-child::before
{
top
:
12px
;}
ul
li
:not
(
:first-child
)
:last-child::before
{
display
:
none
;}
ul
li
:only-child::before
{
display
:
list-item
;
content
:
" "
;
position
:
absolute
;
width
:
1px
;
background-color
:
#000
;
top
:
5px
;
bottom
:
7px
;
height
:
7px
;
left
:
-10px
;
}
ul
li
::after
{
content
:
" "
;
position
:
absolute
;
left
:
-10px
;
width
:
10px
;
height
:
1px
;
background-color
:
#000
;
top
:
12px
;
}
</style>
</head>
<body>
...
...
src/DocView.purs
View file @
21b8ae83
...
...
@@ -28,7 +28,7 @@ import Partial.Unsafe (unsafePartial)
import React (ReactElement)
import React as R
import React.DOM (a, b, b', br, br', div, dt, i, input, li, option, select, span, table, tbody, td, text, thead, tr, ul)
import React.DOM.Props (
_type, className, href, onChange, onClick, selected
, value)
import React.DOM.Props (
Props, _type, className, href, onChange, onClick, selected, style
, value)
import ReactDOM as RDOM
import Thermite (PerformAction, Render, Spec, cotransform, createReactSpec, defaultPerformAction, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
...
...
@@ -95,9 +95,13 @@ instance decodeResponse :: DecodeJson Response where
pure $ Response { cid, created, favorite, ngramCount, hyperdata }
data NTree a = NLeaf a | NNode String (Array (NTree a))
type Name = String
type Open = Boolean
type URL = String
type FTree = NTree (Tuple String String)
data NTree a = NLeaf a | NNode Open Name (Array (NTree a))
type FTree = NTree (Tuple Name URL)
...
...
@@ -151,18 +155,20 @@ spec = simpleSpec performAction render
]
]
exampleTree :: NTree (Tuple String String)
exampleTree =
NNode "Web Sites"
[ NNode "Google"
NNode
true
"Web Sites"
[ NNode
true
"Google"
[ NLeaf (Tuple "Search" "http://google.com/")
, NLeaf (Tuple "Maps" "http://maps.google.com/")
]
, NNode "Social Media"
, NNode
false
"Social Media"
[ NLeaf (Tuple "Google +" "http://plus.google.com/")
, NLeaf (Tuple "Twitter" "http://twitter.com/")
, NLeaf (Tuple "Facebook" "http://facebook.com/")
, NNode "Others"
, NNode
true
"Others"
[ NLeaf (Tuple "Instagram" "https://www.instagram.com/")
, NLeaf (Tuple "WhatsApp" "https://web.whatsapp.com")
]
...
...
@@ -178,16 +184,19 @@ toHtml (NLeaf (Tuple name link)) =
[ text name
]
]
toHtml (NNode name ary) =
ul []
toHtml (NNode
open
name ary) =
ul [
]
[ li [] $
[ i [
className "fas fa-folder"
] []
, text name
[ i [
fldr open
] []
, text
$ " " <>
name
] <>
map toHtml ary
if open then
map toHtml ary
else []
]
fldr :: Boolean -> Props
fldr open = if open then className "fas fa-folder-open" else className "fas fa-folder"
performAction :: PerformAction _ State _ Action
performAction (ChangePageSize ps) _ _ = void (cotransform (\state -> changePageSize ps state ))
...
...
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