diff options
Diffstat (limited to 'desk/web/blog/post-list.hoon')
-rw-r--r-- | desk/web/blog/post-list.hoon | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/desk/web/blog/post-list.hoon b/desk/web/blog/post-list.hoon new file mode 100644 index 0000000..35a3590 --- /dev/null +++ b/desk/web/blog/post-list.hoon @@ -0,0 +1,159 @@ +/- tp=trill-post +/+ sr=sortug, plib=trill-utils, lib=boke, kaji +/= content /web/components/post-text +|% +++ abbreviated-post +|= [cm=content-map:tp button=manx] ^- (list manx) + =/ abbreviated (abbreviate-post:plib cm 1.000) + =/ blocks (latest-contents:plib cm) + ?: .=(blocks abbreviated) %+ turn blocks block:content + %+ snoc (turn abbreviated block:content) button + +++ post-snippet +|= t=thread:tp ^- manx + =/ url (trip (spat path.t)) :: TODO check for relative/absolute path + =+ [[a y] m [d h mm s f]]=(yore id.pid.t) + =/ ys %- trip (ud-to-cord:string:sr y) + :: =/ author (scot %p p.author.p) + =/ count (lent replies.t) + =/ comment-count ?: .=(count 0) "No" "{<count>}" + :: + =/ continue-button + ;div.continue-button-wrapper + ;a.continue-button/"{url}":"Continue" + == + =/ comment-div + ;span + ;a/"{url}#comments":"{comment-count} comments" + == + =/ tag-links + %+ mapi:sr ~(tap in tags.t) + |= [i=@ tg=@t] ^- manx + =/ tt (trip tg) + =/ path "/blog?t={tt}" + =/ show ?: .=(i (dec ~(wyt in tags.t))) tt "{tt}, " + ;a/"{path}":"{show}" + +:: +;article + ;header + ;h2 + ;a/"{url}":"{(trip title.t)}" + == + == + ;main + ;* %+ turn snip.t block:content + ;+ continue-button + == + ;div.post-metadata + ;span + ; Posted on + ;a/"{ys}":"{ys}" + ;a/"{ys}/{<m.m>}":"/{<m.m>}" + ;a/"{ys}/{<m.m>}/{<d.d>}":"/{<d.d>}" + == + :: ;span + :: ; by + :: ;a/"by/{author}":"{author}" + :: == + == + ;+ ?: .=(0 ~(wyt in tags.t)) ;footer ;+ comment-div == + ;footer + ; Tagged as + ;span.tags-links + ;* tag-links + == + ;+ comment-div + == +== +++ css ^~ %- trip +''' +#post-list{ + :: top: 0; + margin: auto; + + & article{ + margin: 0 0 1.5em; + margin-top: 40px; + border-bottom: 1px dotted #dfdfdf; + padding: 0 2rem; + padding-bottom: 40px; + + & header h2{ + font-size: 1.8rem; + text-align: center; + letter-spacing: 1px; + text-transform: uppercase; + line-height: 1.4em; + font-weight: 500; + } + & .post-metadata, article footer{ + font-size: 90%; + font-style: italic; + color: #969696; + } + + & main{ + margin: 1.5em 0 0; + } + } + & .tags-links{ + text-transform: capitalize; + margin-right: 1ch; + } + + & .continue-button-wrapper{ + margin-top: 1.5rem; + margin-bottom: 1.5rem; + } + & .continue-button{ + font-family: 'Montserrat', sans-serif; + text-transform: uppercase; + letter-spacing: 1px; + font-size: 13px; + -webkit-transition: all .4s ease; + -o-transition: all .4s ease; + transition: all .4s ease; + padding: 0.5rem, 0rem, 0.5rem, 1.25rem; + line-height: 1.5; + border-radius: 0.2rem; + } + & .cursor{ + text-align: center; + margin: 1rem; + } +} +@media (max-width: 800px){ + #post-list{ + & article{ + padding: 0; + line-height: 1.7rem; + } + } +} + + +''' +++ test +|= [p=post:tp children=full-graph:tp] ^- manx +=/ pid [author.p id.p] +=/ pat /blog/snip/(scot %uw (jam pid)) +(fetch:kaji pat) +++ cursor +|= [cursor=(unit @da) label=tape] +?~ cursor ;div; +=/ path "/blog/f?cursor={(scow:parsing:sr %uw u.cursor)}" +;div.cursor(kaji "iscroll", path path, cont "#post-list", where "bottom") + ;button:"{label} posts" +== +++ html +|= [p=tpage:tp =marl] +^- manx +;div#post-list.blog + ;style:"{css}" + ;* marl + :: ;+ (cursor newer.p "Newer") + ;* (turn p.p post-snippet) + ;+ (cursor older.p "Older") +== +-- |