Skip to content

Commit ae4c229

Browse files
committed
[chrome] redesign new tab page
1 parent 172f215 commit ae4c229

File tree

3 files changed

+127
-32
lines changed

3 files changed

+127
-32
lines changed

packages/chrome/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const App: Component = function (cx) {
4848
{use(browser.activetab.url, browser.settings.bookmarksPinned)
4949
.map(([u, pinned]) => pinned || u.href === "puter://newtab")
5050
.andThen(<BookmarksStrip />)}
51+
<div style="border-bottom: 1px solid var(--bg20)"></div>
5152
{cx.children}
5253
</div>
5354
);

packages/chrome/src/components/Omnibar/UrlInput.tsx

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ export const UrlInput: Component<
144144
if (title.toLowerCase().startsWith(inputValue.toLowerCase())) {
145145
return (
146146
<>
147+
<span>{title.substring(0, inputValue.length)}</span>
147148
<span style="font-weight: normal; opacity: 0.7;">
148-
{title.substring(0, inputValue.length)}
149+
{title.substring(inputValue.length)}
149150
</span>
150-
<span>{title.substring(inputValue.length)}</span>
151151
</>
152152
);
153153
}
@@ -200,7 +200,18 @@ export const UrlInput: Component<
200200
/>
201201
)}
202202
</div>
203-
<div class="result-content">
203+
<div
204+
class="result-content"
205+
class:single={
206+
// TODO: remove this when non pointed class: works
207+
use(this.url).map(
208+
() =>
209+
item.title == null ||
210+
item.title === "" ||
211+
item.title === trimUrl(item.url)
212+
)
213+
}
214+
>
204215
{(item.title && (
205216
<span class="description">
206217
{renderResultHighlight(item.title, this.input.value)}
@@ -354,32 +365,45 @@ UrlInput.style = css`
354365
.overflowitem {
355366
display: flex;
356367
align-items: center;
357-
height: 2.5em;
368+
/*height: 2.5em;*/
358369
cursor: pointer;
359-
gap: 0.5em;
370+
gap: 1em;
371+
372+
margin-left: 0.5em;
360373
padding-left: 0.5em;
361-
padding-right: 0.5em;
374+
375+
margin-right: 0.5em;
376+
377+
margin-top: 0.25em;
378+
padding-top: 0.25em;
379+
margin-bottom: 0.25em;
380+
padding-bottom: 0.25em;
381+
362382
white-space: nowrap;
363383
color: var(--fg);
364-
width: 100%;
365384
overflow: hidden;
385+
386+
border-radius: var(--radius);
366387
}
367388
368389
.result-content {
369390
display: flex;
370391
flex-direction: column;
371392
flex: 1;
372393
min-width: 0;
373-
overflow: hidden;
374394
gap: 2px;
375395
}
396+
.result-content.single {
397+
display: block;
398+
}
376399
377400
.overflowitem .url,
378401
.overflowitem .description {
379402
text-overflow: ellipsis;
380403
text-wrap: nowrap;
381404
word-wrap: nowrap;
382405
overflow: hidden;
406+
line-height: 1.2;
383407
}
384408
385409
.overflowitem .description {
@@ -397,7 +421,11 @@ UrlInput.style = css`
397421
text-overflow: ellipsis;
398422
overflow: hidden;
399423
}
400-
.overflowitem.focused {
424+
.overflowitem.focused,
425+
.overflowitem.focused:hover {
426+
background: var(--bg20);
427+
}
428+
.overflowitem:hover {
401429
background: var(--bg04);
402430
}
403431

packages/chrome/src/pages/NewTabPage.tsx

Lines changed: 89 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { browser } from "../Browser";
44
import { trimUrl } from "../components/Omnibar/utils";
55
import { createMenu } from "../components/Menu";
66
import { defaultFaviconUrl } from "../assets/favicon";
7+
import { Icon } from "../components/Icon";
8+
import { iconSearch } from "../icons";
79

810
export const NewTabPage: Component<
911
{
@@ -13,16 +15,32 @@ export const NewTabPage: Component<
1315
> = function () {
1416
return (
1517
<div>
18+
<div class="topbar">
19+
{/*<div class="logo"></div>*/}
20+
<div class="inputcontainercontainer">
21+
<div class="inputcontainer">
22+
<div class="icon">
23+
<Icon icon={iconSearch}></Icon>
24+
</div>
25+
<input
26+
on:keydown={(e: KeyboardEvent) => {
27+
if (e.key === "Enter") {
28+
e.preventDefault();
29+
browser.searchNavigate((e.target as HTMLInputElement).value);
30+
}
31+
}}
32+
placeholder="Search Google or type A URL"
33+
></input>
34+
</div>
35+
</div>
36+
{/*<div class="clock">
37+
{new Date().toLocaleTimeString([], {
38+
hour: "2-digit",
39+
minute: "2-digit",
40+
})}
41+
</div>*/}
42+
</div>
1643
<div class="main">
17-
<input
18-
on:keydown={(e: KeyboardEvent) => {
19-
if (e.key === "Enter") {
20-
e.preventDefault();
21-
browser.searchNavigate((e.target as HTMLInputElement).value);
22-
}
23-
}}
24-
placeholder="Search Google or type A URL"
25-
></input>
2644
<div class="suggestions">
2745
{browser.globalhistory.slice(0, 5).map((entry) => (
2846
<div
@@ -61,10 +79,69 @@ NewTabPage.style = css`
6179
width: 100%;
6280
height: 100%;
6381
display: flex;
64-
justify-content: center;
82+
flex-direction: column;
83+
align-items: center;
6584
font-family: var(--font);
6685
background: var(--bg01);
6786
color: var(--fg);
87+
88+
padding: 5em;
89+
}
90+
91+
.topbar {
92+
width: 100%;
93+
display: flex;
94+
align-items: center;
95+
justify-content: center;
96+
gap: 3em;
97+
}
98+
.logo {
99+
width: 3em;
100+
height: 3em;
101+
}
102+
.clock {
103+
font-size: 1.5em;
104+
font-weight: bold;
105+
min-width: 4em;
106+
text-align: center;
107+
}
108+
109+
.inputcontainercontainer {
110+
flex: 1;
111+
display: flex;
112+
justify-content: center;
113+
}
114+
.inputcontainer {
115+
flex: 1;
116+
max-width: 40em;
117+
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
118+
background: var(--bg20);
119+
border-radius: var(--radius);
120+
display: flex;
121+
align-items: center;
122+
}
123+
124+
.icon {
125+
font-size: 1.5em;
126+
padding-left: 0.5em;
127+
color: var(--fg3);
128+
}
129+
130+
.inputcontainer:focus-within {
131+
box-shadow: 0 0 2px var(--accent);
132+
outline: 1px solid var(--accent);
133+
}
134+
input {
135+
font-size: 1.25em;
136+
outline: none;
137+
padding: 1em;
138+
padding-top: 0.75em;
139+
padding-bottom: 0.75em;
140+
flex: 1;
141+
height: 100%;
142+
background: none;
143+
border: none;
144+
color: var(--fg);
68145
}
69146
70147
.suggestions {
@@ -108,34 +185,23 @@ NewTabPage.style = css`
108185
text-overflow: ellipsis;
109186
text-align: center;
110187
white-space: nowrap;
188+
line-height: 1.2;
111189
}
112190
.suggestion img {
113191
width: 32px;
114192
height: 32px;
115193
}
116194
117195
.main {
196+
margin-top: 2.5em;
118197
width: 70%;
119198
display: flex;
120199
flex-direction: column;
121200
align-items: center;
122201
gap: 1em;
123202
}
124203
125-
input {
126-
width: 100%;
127-
height: 2em;
128-
font-size: 1.5em;
129-
border: 2px solid var(--bg20);
130-
outline: none;
131-
border-radius: 1em;
132-
padding: 1em;
133-
background: var(--bg);
134-
color: var(--fg);
135-
}
136-
137204
.main {
138205
position: relative;
139-
top: 10em;
140206
}
141207
`;

0 commit comments

Comments
 (0)