Skip to content

Commit fa424d1

Browse files
committed
ship review styles
1 parent 94e1703 commit fa424d1

File tree

11 files changed

+126
-113
lines changed

11 files changed

+126
-113
lines changed

special-pages/pages/new-tab/app/activity/ActivityProvider.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,17 @@ function normalizeItems(prev, data) {
189189
}
190190

191191
/**
192-
* @param {string[]} prev
192+
* @param {{ available: string[]; max: number }} prev
193193
* @param {ActivityData} data
194-
* @return {string[]}
194+
* @return {{ available: string[]; max: number }}
195195
*/
196-
function normalize(prev, data) {
196+
function normalizeKeys(prev, data) {
197197
const keys = data.activity.map((x) => x.url);
198-
return shallowDiffers(prev, keys) ? keys : prev;
198+
const next = shallowDiffers(prev, keys) ? keys : prev.available;
199+
return {
200+
available: next,
201+
max: keys.length,
202+
};
199203
}
200204

201205
/**
@@ -212,7 +216,7 @@ export function shallowDiffers(a, b) {
212216

213217
export const SignalStateContext = createContext({
214218
activity: signal(/** @type {NormalizedActivity} */ ({})),
215-
keys: signal(/** @type {string[]} */ ([])),
219+
keys: signal(/** @type {{available: string[]; max: number}} */ ({ available: [], max: 0 })),
216220
});
217221

218222
export function SignalStateProvider({ children }) {
@@ -221,7 +225,7 @@ export function SignalStateProvider({ children }) {
221225
if (state.status !== 'ready') throw new Error('must have ready status here');
222226
if (!service) throw new Error('must have service here');
223227

224-
const keys = useSignal(normalize([], state.data));
228+
const keys = useSignal(normalizeKeys({ available: [], max: 0 }, state.data));
225229
const activity = useSignal(
226230
normalizeItems(
227231
{
@@ -237,9 +241,8 @@ export function SignalStateProvider({ children }) {
237241
useSignalEffect(() => {
238242
if (!service) return console.warn('could not access service');
239243
const unsub = service.onData((evt) => {
240-
const next = normalize(keys.value, evt.data);
241244
batch(() => {
242-
keys.value = next;
245+
keys.value = normalizeKeys(keys.value, evt.data);
243246
activity.value = normalizeItems(activity.value, evt.data);
244247
});
245248
});

special-pages/pages/new-tab/app/activity/components/Activity.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useDocumentVisibility } from '../../utils.js';
99
import { useCustomizer } from '../../customizer/components/CustomizerMenu.js';
1010
import { usePlatformName } from '../../settings.provider.js';
1111
import { Heading } from '../../privacy-stats/components/PrivacyStats.js';
12-
import { Chevron } from '../../components/Icons.js';
12+
import { ChevronSmall } from '../../components/Icons.js';
1313
import { CompanyIcon } from '../../components/CompanyIcon.js';
1414
import { Trans } from '../../../../../shared/components/TranslationsProvider.js';
1515
import { ActivityItem } from './ActivityItem.js';
@@ -81,21 +81,24 @@ function ActivityBody({ canBurn }) {
8181
const { keys } = useContext(SignalStateContext);
8282
const { burning, exiting } = useContext(ActivityBurningSignalContext);
8383
const busy = useComputed(() => burning.value.length > 0 || exiting.value.length > 0);
84+
8485
return (
85-
<ul class={styles.activity} onClick={didClick} data-busy={busy}>
86-
{keys.value.map((id, index) => {
87-
if (canBurn && !isReducedMotion) return <BurnableItem id={id} key={id} documentVisibility={documentVisibility} />;
88-
return <RemovableItem id={id} key={id} canBurn={canBurn} documentVisibility={documentVisibility} />;
89-
})}
90-
</ul>
86+
<Fragment>
87+
<ul class={styles.activity} onClick={didClick} data-busy={busy}>
88+
{keys.value.available.map((id, index) => {
89+
if (canBurn && !isReducedMotion) return <BurnableItem id={id} key={id} documentVisibility={documentVisibility} />;
90+
return <RemovableItem id={id} key={id} canBurn={canBurn} documentVisibility={documentVisibility} />;
91+
})}
92+
</ul>
93+
</Fragment>
9194
);
9295
}
9396

9497
const BurnableItem = memo(
9598
/**
9699
* @param {object} props
97100
* @param {string} props.id
98-
* @param {"visible" | "hidden"} props.documentVisibility
101+
* @param {'visible' | 'hidden'} props.documentVisibility
99102
*/
100103
function BurnableItem({ id, documentVisibility }) {
101104
const { activity } = useContext(SignalStateContext);
@@ -240,7 +243,7 @@ function HistoryItems({ id }) {
240243
: t('activity_show_less_history')
241244
}
242245
>
243-
<Chevron />
246+
<ChevronSmall />
244247
</button>
245248
)}
246249
</li>

special-pages/pages/new-tab/app/activity/components/Activity.module.css

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.root {
22

33
--favicon-width: 32px;
4-
--heading-gap: 12px;
4+
--heading-gap: 8px;
55

66

77
background: var(--ntp-surface-background-color);
@@ -15,10 +15,8 @@
1515
width: 100%;
1616
margin-bottom: var(--ntp-gap);
1717

18-
&:hover {
19-
.listExpander * {
20-
opacity: 1;
21-
}
18+
.listExpander * {
19+
opacity: 1;
2220
}
2321

2422
[data-theme=dark] & {
@@ -27,8 +25,9 @@
2725
}
2826

2927
.activity {
30-
width: 100%;
3128
overflow: hidden;
29+
width: calc(100% + 12px);
30+
margin-left: -6px;
3231
}
3332

3433
.activity:not(:empty) {
@@ -53,6 +52,8 @@
5352
.item {
5453
padding-top: 16px;
5554
padding-bottom: 16px;
55+
padding-left: 6px;
56+
padding-right: 6px;
5657
}
5758

5859
.burning {
@@ -65,28 +66,31 @@
6566

6667
.heading {
6768
display: flex;
68-
gap: 12px;
69+
gap: var(--heading-gap);
6970
width: 100%;
7071
}
7172

7273
.favicon {
7374
width: 32px;
7475
height: 32px;
76+
display: block;
77+
backdrop-filter: blur(24px);
7578
border-radius: var(--border-radius-sm);
7679
flex-shrink: 0;
7780
text-decoration: none;
7881
position: relative;
79-
8082
background: var(--color-black-at-12);
81-
&:hover, &:focus-visible {
82-
background: var(--color-black-at-18);
83-
}
83+
transition: transform .2s;
84+
85+
border: 0.5px solid rgba(0, 0, 0, 0.09);
86+
background: rgba(255, 255, 255, 0.30);
87+
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.12), 0px 0px 1.5px 0px rgba(0, 0, 0, 0.16);
8488

8589
[data-theme="dark"] & {
86-
background: var(--color-white-at-6);
87-
&:hover, &:focus-visible {
88-
background: var(--color-white-at-9);
89-
}
90+
border: 0.5px solid rgba(255, 255, 255, 0.09);
91+
background: rgba(0, 0, 0, 0.18);
92+
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.12), 0px 0px 1.5px 0px rgba(0, 0, 0, 0.16);
93+
backdrop-filter: blur(24px);
9094
}
9195

9296
> *:first-child {
@@ -101,16 +105,21 @@
101105
font-size: var(--title-3-em-font-size);
102106
font-weight: var(--title-3-em-font-weight);
103107
line-height: var(--title-3-em-line-height);
104-
display: block;
105108
word-break: break-all;
106109
overflow-wrap: break-word;
107-
white-space: normal;
108-
padding-top: 4px;
110+
white-space: nowrap;
109111
text-decoration: none;
110112
color: var(--ntp-text-normal);
113+
height: 35px;
114+
display: flex;
115+
align-items: center;
116+
gap: 8px;
111117

112118
&:hover, &:focus-visible {
113-
text-decoration: underline;
119+
color: var(--ntp-color-primary);
120+
.favicon {
121+
transform: scale(1.08)
122+
}
114123
}
115124
}
116125

@@ -119,6 +128,7 @@
119128
margin-left: auto;
120129
flex-shrink: 0;
121130
position: relative;
131+
gap: 4px;
122132
top: 4px;
123133
}
124134

@@ -140,13 +150,18 @@
140150
}
141151

142152
.controlIcon {
143-
border-radius: 4px;
153+
border-radius: 50%;
154+
background-color: var(--color-black-at-3);
144155
&:hover {
145-
background-color: var(--color-black-at-12);
156+
background-color: var(--color-black-at-6);
146157
}
147-
[data-theme="dark"] &:hover {
158+
159+
[data-theme="dark"] & {
148160
background-color: var(--color-white-at-6);
149161
}
162+
[data-theme="dark"] &:hover {
163+
background-color: var(--color-white-at-9);
164+
}
150165
svg {
151166
fill-opacity: 0.6;
152167
}
@@ -162,20 +177,8 @@
162177
padding-left: calc(var(--favicon-width) + var(--heading-gap));
163178
padding-right: calc(var(--favicon-width) + var(--heading-gap) * 2);
164179
position: relative;
165-
166-
&:before {
167-
content: " ";
168-
width: 1px;
169-
height: 100%;
170-
position: absolute;
171-
top: 0;
172-
left: 15px;
173-
background: var(--color-black-at-12);
174-
}
175-
[data-theme="dark"] &:before {
176-
background: var(--color-white-at-6);
177-
}
178180
}
181+
179182
.otherIcon {
180183
width: 16px;
181184
height: 16px;
@@ -201,7 +204,7 @@
201204

202205
.companiesIcons {
203206
display: flex;
204-
gap: 2px;
207+
gap: 3px;
205208
> * {
206209
flex-shrink: 0;
207210
min-width: 0;
@@ -210,28 +213,29 @@
210213
.companiesText {}
211214

212215
.history {
213-
margin-top: 6px;
216+
margin-top: 12px;
214217
}
215218
.historyItem {
216219
display: flex;
220+
align-items: center;
217221
width: 100%;
218222
+ .historyItem {
219-
margin-top: var(--sp-1);
223+
margin-top: 6px;
220224
}
221225
}
222226
.historyLink {
223227
font-size: var(--small-label-font-size);
224228
font-weight: var(--small-label-font-weight);
225229
line-height: var(--small-label-line-height);
226-
color: var(--ntp-text-muted);
230+
color: var(--ntp-text-normal);
227231
text-decoration: none;
228232
min-width: 0;
229233
white-space: nowrap;
230234
overflow: hidden;
231235
text-overflow: ellipsis;
232236

233237
&:hover, &:focus-visible {
234-
text-decoration: underline;
238+
color: var(--ntp-color-primary)
235239
}
236240

237241
&:hover .time {
@@ -243,7 +247,7 @@
243247
.time {
244248
flex-shrink: 0;
245249
margin-left: 8px;
246-
color: var(--ntp-text-muted-more);
250+
color: var(--ntp-text-muted);
247251
font-size: var(--small-label-font-size);
248252
font-weight: var(--small-label-font-weight);
249253
line-height: var(--small-label-line-height);
@@ -264,20 +268,23 @@
264268
display: flex;
265269
align-items: center;
266270
justify-content: center;
267-
color: var(--ntp-text-normal);
271+
color: var(--color-black-at-60);
268272

269273
&:hover {
270-
background-color: var(--color-black-at-12)
274+
background-color: var(--color-black-at-6);
271275
}
272276

273-
[data-theme="dark"] &:hover {
274-
background-color: var(--color-white-at-6);
277+
[data-theme="dark"] & {
278+
color: var(--color-white-at-60);
279+
&:hover {
280+
background-color: var(--color-white-at-6);
281+
}
275282
}
276283

277284
svg {
278285
display: inline-block;
279-
width: 10px;
280-
height: 10px;
286+
width: 16px;
287+
height: 16px;
281288
position: relative;
282289
top: 1px;
283290
transform: rotate(0);

special-pages/pages/new-tab/app/activity/components/ActivityItem.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ export const ActivityItem = memo(
2828
return (
2929
<li key={url} class={cn(styles.item)} data-testid="ActivityItem">
3030
<div class={styles.heading}>
31-
<a class={styles.favicon} href={url} title={title} data-url={url}>
32-
{documentVisibility === 'visible' && (
33-
<ImageWithState
34-
faviconSrc={favoriteSrc}
35-
faviconMax={faviconMax}
36-
title={title}
37-
etldPlusOne={etldPlusOne}
38-
theme={'light'}
39-
displayKind={'history-favicon'}
40-
/>
41-
)}
42-
</a>
4331
<a class={styles.title} href={url} data-url={url}>
32+
<span className={styles.favicon} data-url={url}>
33+
{documentVisibility === 'visible' && (
34+
<ImageWithState
35+
faviconSrc={favoriteSrc}
36+
faviconMax={faviconMax}
37+
title={title}
38+
etldPlusOne={etldPlusOne}
39+
theme={'light'}
40+
displayKind={'history-favicon'}
41+
/>
42+
)}
43+
</span>
4444
{title}
4545
</a>
4646
<Controls canBurn={canBurn} url={url} title={title} />

0 commit comments

Comments
 (0)