File tree Expand file tree Collapse file tree 1 file changed +35
-35
lines changed
sites/hn.svelte.dev/src/routes/item/[id] Expand file tree Collapse file tree 1 file changed +35
-35
lines changed Original file line number Diff line number Diff line change 99 * }}
1010 */
1111 export let comment;
12-
13- let hidden = false ;
1412 </script >
1513
1614{#if ! comment .deleted }
17- <article class =" comment" class:hidden >
18- <div
19- class =" meta-bar"
20- role =" button"
21- tabindex =" 0"
22- on:click ={() => (hidden = ! hidden )}
23- on:keyup ={(e ) => e .key === ' ' && (hidden = ! hidden )}
24- >
25- <span class =" meta" >
26- <a href ="/user/ {comment .user }" >{comment .user }</a >
27- {comment .time_ago }
28- </span >
29- </div >
30-
31- <div class =" body" >
32- {@html comment .content }
33- </div >
34-
35- {#if comment .comments .length > 0 }
36- <ul class =" children" >
37- {#each comment .comments as child }
38- <li ><svelte:self comment ={child } /></li >
39- {/each }
40- </ul >
41- {/if }
15+ <article class =" comment" >
16+ <details open >
17+ <summary >
18+ <div class =" meta-bar" role =" button" tabindex =" 0" >
19+ <span class =" meta" >
20+ <a href ="/user/ {comment .user }" >{comment .user }</a >
21+ {comment .time_ago }
22+ </span >
23+ </div >
24+ </summary >
25+
26+ <div class =" body" >
27+ {@html comment .content }
28+ </div >
29+
30+ {#if comment .comments .length > 0 }
31+ <ul class =" children" >
32+ {#each comment .comments as child }
33+ <li ><svelte:self comment ={child } /></li >
34+ {/each }
35+ </ul >
36+ {/if }
37+ </details >
4238 </article >
4339{/if }
4440
5450 .meta-bar {
5551 padding : 1em 0 ;
5652 cursor : pointer ;
57- background : 100% 50% no-repeat url (./fold .svg );
53+ background : 100% 50% no-repeat url (./unfold .svg );
5854 background-size : 1em 1em ;
5955 }
6056
61- .hidden .meta-bar {
62- background-image : url (./unfold .svg );
57+ .comment details [ open ] .meta-bar {
58+ background-image : url (./fold .svg );
6359 }
6460
65- .comment .children {
66- padding : 0 0 0 1em ;
67- margin : 0 ;
61+ .comment details > summary {
62+ list-style-type : none ;
6863 }
6964
70- .hidden .body ,
71- .hidden .children {
65+ .comment details > summary ::marker ,
66+ .comment details > summary ::-webkit-details-marker {
7267 display : none ;
7368 }
7469
70+ .comment .children {
71+ padding : 0 0 0 1em ;
72+ margin : 0 ;
73+ }
74+
7575 @media (min-width : 720px ) {
7676 .comment .children {
7777 padding : 0 0 0 2em ;
You can’t perform that action at this time.
0 commit comments