@@ -9,31 +9,39 @@ import { defaultFaviconUrl } from "../assets/favicon";
99export function DownloadsPage ( s : { tab : Tab } ) {
1010 return (
1111 < div >
12- < div class = "main" >
12+ < nav >
1313 < h1 > Downloads</ h1 >
14- < div class = "entries" >
15- { use ( browser . globalDownloadHistory ) . mapEach ( ( e ) => (
16- < div class = "entry" >
17- < div class = "iconcontainer" >
18- < img src = { defaultFaviconUrl } > </ img >
19- </ div >
20- < div class = "content" >
21- < a href = { e . url } > { e . filename } </ a >
22- < span >
23- < span > { formatBytes ( e . size ) } </ span >
24- < span > { new URL ( e . url ) . hostname } </ span >
25- < span > { new Date ( e . timestamp ) . toDateString ( ) } </ span >
26- </ span >
27- </ div >
28- < div class = "icons" >
29- < Icon icon = { iconFolder } > </ Icon >
30- < Icon icon = { iconLink } > </ Icon >
31- < Icon icon = { iconClose } > </ Icon >
32- </ div >
33- </ div >
34- ) ) }
35- </ div >
36- </ div >
14+ </ nav >
15+ < ul class = "entries" >
16+ { use ( browser . globalDownloadHistory ) . mapEach ( ( entry ) => {
17+ const url = new URL ( entry . url ) ;
18+ return (
19+ < li
20+ class = "entry"
21+ on :click = { ( ) => {
22+ browser . newTab ( url ) ;
23+ } }
24+ >
25+ < span class = "inner" >
26+ < img src = { defaultFaviconUrl } alt = "favicon" />
27+ < div class = "text" >
28+ < span class = "title" > { entry . filename } </ span >
29+ < span class = "url" > { url . hostname } </ span >
30+ < div class = "details" >
31+ < span > { formatBytes ( entry . size ) } </ span >
32+ < span > { new Date ( entry . timestamp ) . toDateString ( ) } </ span >
33+ </ div >
34+ </ div >
35+ < div class = "icons" >
36+ < Icon icon = { iconFolder } > </ Icon >
37+ < Icon icon = { iconLink } > </ Icon >
38+ < Icon icon = { iconClose } > </ Icon >
39+ </ div >
40+ </ span >
41+ </ li >
42+ ) ;
43+ } ) }
44+ </ ul >
3745 </ div >
3846 ) ;
3947}
@@ -43,80 +51,83 @@ DownloadsPage.style = css`
4351 height : 100% ;
4452 display : flex;
4553 flex-direction : column;
46- align-items : center;
47- font-family : sans-serif;
48-
54+ align-items : flex-start;
4955 background : var (--bg01 );
5056 color : var (--fg );
51- overflow-y : scroll;
5257 }
53-
54- a {
55- color : color-mix (in oklab, var (--fg ) 50% , var (--accent ));
58+ nav {
59+ width : 100% ;
60+ padding : 1.5em ;
61+ background : var (--bg02 );
5662 }
57-
58- .main {
59- display : flex;
60- flex-direction : column;
61- gap : 1em ;
62- justify-content : center;
63+ h1 {
64+ font-size : 1.5rem ;
65+ font-weight : 600 ;
66+ margin-left : 0 ;
6367 }
6468 .entries {
65- display : flex ;
66- flex-direction : column ;
67- gap : 1 em ;
69+ list-style : none ;
70+ padding : 0 ;
71+ margin : 0 ;
6872 width : 100% ;
73+ padding-right : 1.75em ;
6974 }
7075 .entry {
76+ width : 100% ;
77+ transition : background 0.1s ;
78+ }
79+ .inner {
7180 display : flex;
72- /*border-bottom: 1px solid #ccc;*/
81+ align-items : center;
82+ gap : 0.5em ;
7383 cursor : pointer;
74- gap : 3em ;
75-
76- width : 100% ;
77- background : var (--bg04 );
78- /*height: 10em;*/
79-
80- border-radius : var (--radius );
81- padding : 2em ;
82- box-shadow : 0 4px 8px rgba (0 , 0 , 0 , 0.1 );
84+ padding-block : 0.75em ;
85+ padding-left : 0.5em ;
86+ margin-left : 1.75em ;
87+ border-bottom : 1px solid var (--bg08 );
88+ }
89+ .entry : hover {
90+ background : var (--bg08 );
8391 }
8492 .entry img {
8593 width : 16px ;
8694 height : 16px ;
8795 }
8896 .entry .title {
8997 font-weight : bold;
98+ color : inherit;
99+ text-decoration : none;
90100 }
91-
92- .iconcontainer {
93- width : 2em ;
94- height : 100% ;
95- justify-content : center;
101+ .entry .title : hover {
102+ color : var (--accent );
103+ text-decoration : underline;
96104 }
97- .iconcontainer img {
98- width : 100% ;
99- height : auto;
105+ .inner span {
106+ white-space : nowrap;
107+ overflow : hidden;
108+ padding : 0.085em ;
109+ text-overflow : ellipsis;
100110 }
101-
102- .icons {
111+ .text {
112+ display : flex;
113+ flex-direction : column;
114+ gap : 0.25em ;
103115 flex : 1 ;
116+ min-width : 0 ;
117+ }
118+ .details {
104119 display : flex;
105- justify-content : right;
106- gap : 0.5em ;
107-
108- font-size : 1.5em ;
120+ gap : 1em ;
121+ color : var (--fg2 );
109122 }
110-
111- .content {
123+ .icons {
112124 display : flex;
113- flex-direction : column;
114125 gap : 0.5em ;
126+ margin-left : 0.75em ;
115127 }
116-
117- .content > span {
118- display : flex;
119- gap : 1em ;
128+ .icons : global (svg ) {
129+ width : 1em ;
130+ height : 1em ;
120131 color : var (--fg2 );
121132 }
122133` ;
0 commit comments