Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Tab Page and NTP Widget styles #1229

Merged
merged 37 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a9f0604
fix: NextSteps bubble position, rm the unused mock provider
vkraucunas Nov 15, 2024
a4fc554
chore: Add RMF to default page, adjust NextSteps styels
vkraucunas Nov 17, 2024
fc43270
chore: Add common border radii 4, 6, 8, 12px
vkraucunas Nov 18, 2024
bc719e1
fix: tests, first attempt
vkraucunas Nov 19, 2024
bbe1972
reverting adding the RMF to the default page
vkraucunas Nov 19, 2024
2ac9e4c
feat: Add hover show/hide on NExtSteps
vkraucunas Nov 19, 2024
8d6dab0
chore: Add focus ring consistency
vkraucunas Nov 19, 2024
9f333b2
chore: Update text colors to use ntp theme values
vkraucunas Nov 19, 2024
480be65
chore: remove unneeded css
vkraucunas Nov 19, 2024
b20bda6
wip
vkraucunas Nov 19, 2024
7573819
fix: file names
vkraucunas Nov 19, 2024
e1a3790
fix: bubble location
vkraucunas Nov 19, 2024
aac030b
fix: addAppToDockMac NextSteps variant
vkraucunas Nov 19, 2024
9617b86
chore: Add 0 gap option to Stack, use in WidgetList
vkraucunas Nov 20, 2024
f44dfc5
chore: remove ShowHideButtonWithText, update ShowHideButton to handle…
vkraucunas Nov 20, 2024
8684951
chore: Update ChevronButton Icon
vkraucunas Nov 20, 2024
cb6dfc9
chore: Add long title option to the Favorites data
vkraucunas Nov 20, 2024
aa8c66d
chore: Adjust widget spacing values
vkraucunas Nov 20, 2024
cf98121
chore: A few cleanups
vkraucunas Nov 20, 2024
d357925
chore: Reorg RMF
vkraucunas Nov 20, 2024
275af6e
chore: Reorg PrivacyStats
vkraucunas Nov 20, 2024
65583f1
fix: PrivacyStats reorg
vkraucunas Nov 20, 2024
e258391
chore: Reorg Customizer
vkraucunas Nov 20, 2024
c1be47e
chore: Update Examples
vkraucunas Nov 20, 2024
b3301fb
fix: Favorites tests
vkraucunas Nov 21, 2024
38f7958
chore: Add type info to the Examples in each widget
vkraucunas Nov 21, 2024
3e5b990
fix: Examples view
vkraucunas Nov 21, 2024
187841e
fix: Component item relative to contain absolutely positioned items
vkraucunas Nov 21, 2024
95a1300
chore: Rename example files consistently
vkraucunas Nov 21, 2024
68096e9
chore: UpdateNotification added to correct space, switched to Dismiss…
vkraucunas Nov 21, 2024
23a2db8
fix: lint
vkraucunas Nov 21, 2024
3544c12
chore: Remove unneeded color
vkraucunas Nov 21, 2024
ac1a8ca
chore: Add a gap var to the ntp-theme css and apply across widgets
vkraucunas Nov 21, 2024
53d879b
rebase bugfix
Nov 21, 2024
94e22e4
chore: Fix rmf spacing
vkraucunas Nov 21, 2024
f722e7d
fix: Favorites test
vkraucunas Nov 21, 2024
c342d13
fix: thin focus ring
vkraucunas Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions special-pages/messages/new-tab/examples/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const widgetConfig = {
const initialSetupResponse = {
widgets: [{ id: 'updateNotification' }, { id: 'rmf' }, { id: 'favorites' }, { id: 'privacyStats' }],
widgetConfigs: [
{ id: 'rmf', visibility: 'visible' },
{ id: 'nextSteps', visibility: 'visible' },
{ id: 'favorites', visibility: 'visible' },
{ id: 'privacyStats', visibility: 'visible' },
],
Expand Down
2 changes: 0 additions & 2 deletions special-pages/pages/new-tab/app/components/Components.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Fragment, h } from 'preact';
import styles from './Components.module.css';
import { mainExamples, otherExamples } from './Examples.jsx';
import { updateNotificationExamples } from '../update-notification/UpdateNotification.examples.js';
const url = new URL(window.location.href);

const list = {
...mainExamples,
...otherExamples,
...updateNotificationExamples,
};

const entries = Object.entries(list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body[data-display="components"] {
color: var(--ntp-text-normal);
padding: 0.2em 0.3em;
border: 1px solid var(--color-gray-60);
border-radius: 4px;
border-radius: var(--border-radius-xs);
display: inline-block;
line-height: 1;
text-decoration: none;
Expand Down Expand Up @@ -72,7 +72,6 @@ body[data-display="components"] {
gap: 1rem; /* Adjust the gap size as needed */
}

.selectItem {
.item {
position: relative;
}

.item {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
border-width: 0;
text-wrap: nowrap;
font-weight: 600;
font-size: calc(11 * var(--px-in-rem));
line-height: calc(11 * var(--px-in-rem));
color: var(--ntp-color-primary);
height: 1rem;
width: 1rem;
padding: 0;
line-height: 1;
background-color: transparent;
color: var(--color-black-at-60);
color: var(--ntp-text-muted);
border: none;
border-radius: 50%;

transition: all .3s;

&:hover {
background-color: var(--color-black-at-9);
Expand All @@ -22,7 +19,7 @@

&:active {
background-color: var(--color-black-at-18);
color: var(--color-black-at-84);
color: var(--ntp-text-normal);
}

&:disabled {
Expand All @@ -35,20 +32,17 @@
}

&:focus-visible {
box-shadow: 0px 0px 0px 1px var(--color-white), 0px 0px 0px 3px var(--ntp-focus-outline-color);
box-shadow: var(--focus-ring);
outline: none;
}

@media screen and (prefers-color-scheme: dark) {
color: var(--color-white-at-60);


&:hover {
background-color: var(--color-black-at-9);
}

&:active {
background-color: var(--color-white-at-18);
color: var(--color-white-at-84);
}

&:disabled {
Expand All @@ -60,42 +54,5 @@
cursor: not-allowed;
background-color: var(--color-white-at-12);
}

&:focus-visible {
box-shadow: 0px 0px 0px 1px var(--ntp-focus-outline-color), 0px 0px 0px 3px var(--color-white);
}
}
}
/*
.dismissBtn {
height: 1rem;
width: 1rem;
padding: 0;
line-height: 1;
background-color: transparent;
color: var(--color-black-at-60);
border: none;
border-radius: 50%;

&:active {
background-color: var(--color-black-at-18);
color: var(--color-black-at-84);
}

&:hover {
background-color: var(--color-black-at-9);
}

@media screen and (prefers-color-scheme: dark) {
color: var(--color-white-at-60);

&:hover {
background-color: var(--color-white-at-9);
}

&:active {
background-color: var(--color-white-at-18);
color: var(--color-white-at-84);
}
}
} */
}
174 changes: 13 additions & 161 deletions special-pages/pages/new-tab/app/components/Examples.jsx
Original file line number Diff line number Diff line change
@@ -1,172 +1,24 @@
import { Fragment, h } from 'preact';
import { PrivacyStatsMockProvider } from '../privacy-stats/mocks/PrivacyStatsMockProvider.js';
import { Body, Heading, PrivacyStatsConsumer } from '../privacy-stats/PrivacyStats.js';
import { RemoteMessagingFramework } from '../remote-messaging-framework/RemoteMessagingFramework.js';
import { nextStepsExamples, otherNextStepsExamples } from '../next-steps/components/NextStepsExamples.js';
import { stats } from '../privacy-stats/mocks/stats.js';
import { h } from 'preact';
import { favoritesExamples } from '../favorites/components/Favorites.examples.js';
import { otherPrivacyStatsExamples, privacyStatsExamples } from '../privacy-stats/components/PrivacyStats.examples.js';
import { nextStepsExamples, otherNextStepsExamples } from '../next-steps/components/NextSteps.examples.js';
import { otherRMFExamples, RMFExamples } from '../remote-messaging-framework/components/RMF.examples.js';
import { customizerExamples } from '../customizer/components/Customizer.examples.js';
import { noop } from '../utils.js';
import { VisibilityMenu } from '../customizer/VisibilityMenu.js';
import { CustomizerButton } from '../customizer/Customizer.js';
import { rmfDataExamples } from '../remote-messaging-framework/mocks/rmf.data.js';
import { favoritesExamples } from '../favorites/components/FavoritesExamples.js';
import { updateNotificationExamples } from '../update-notification/components/UpdateNotification.examples.js';

/** @type {Record<string, {factory: () => import("preact").ComponentChild}>} */
export const mainExamples = {
'stats.few': {
factory: () => (
<PrivacyStatsMockProvider ticker={true}>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'stats.few.collapsed': {
factory: () => (
<PrivacyStatsMockProvider config={{ expansion: 'collapsed' }}>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'stats.single': {
factory: () => (
<PrivacyStatsMockProvider data={stats.single}>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'stats.none': {
factory: () => (
<PrivacyStatsMockProvider data={stats.none}>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'stats.norecent': {
factory: () => (
<PrivacyStatsMockProvider data={stats.norecent}>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'stats.list': {
factory: () => <Body trackerCompanies={stats.few.trackerCompanies} listAttrs={{ id: 'example-stats.list' }} />,
},
'stats.heading': {
factory: () => (
<Heading
trackerCompanies={stats.few.trackerCompanies}
totalCount={stats.few.totalCount}
expansion={'expanded'}
onToggle={noop('stats.heading onToggle')}
/>
),
},
'stats.heading.none': {
factory: () => (
<Heading
trackerCompanies={stats.none.trackerCompanies}
totalCount={stats.none.totalCount}
expansion={'expanded'}
onToggle={noop('stats.heading onToggle')}
/>
),
},
'rmf.small': {
factory: () => <RemoteMessagingFramework message={rmfDataExamples.small.content} dismiss={() => {}} />,
},
'rmf.medium': {
factory: () => <RemoteMessagingFramework message={rmfDataExamples.medium.content} dismiss={() => {}} />,
},
'rmf.big-single-action': {
factory: () => (
<RemoteMessagingFramework message={rmfDataExamples.big_single_action.content} primaryAction={() => {}} dismiss={() => {}} />
),
},
'rmf.big-two-action': {
factory: () => (
<RemoteMessagingFramework
message={rmfDataExamples.big_two_action.content}
primaryAction={() => {}}
secondaryAction={() => {}}
dismiss={() => {}}
/>
),
},
...favoritesExamples,
...nextStepsExamples,
...privacyStatsExamples,
...RMFExamples,
};

export const otherExamples = {
'stats.without-animation': {
factory: () => (
<PrivacyStatsMockProvider
ticker={true}
config={{
expansion: 'expanded',
animation: { kind: 'none' },
}}
>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'stats.with-view-transitions': {
factory: () => (
<PrivacyStatsMockProvider
ticker={true}
config={{
expansion: 'expanded',
animation: { kind: 'view-transitions' },
}}
>
<PrivacyStatsConsumer />
</PrivacyStatsMockProvider>
),
},
'rmf.big-two-action-overflow': {
factory: () => (
<RemoteMessagingFramework
message={rmfDataExamples.big_two_action_overflow.content}
primaryAction={() => {}}
secondaryAction={() => {}}
dismiss={() => {}}
/>
),
},
...otherNextStepsExamples,
'customizer-menu': {
factory: () => (
<Fragment>
<div>
<CustomizerButton isOpen={true} />
</div>
<br />
<MaxContent>
<VisibilityMenu
rows={[
{
id: 'favorites',
title: 'Favorites',
icon: 'star',
toggle: noop('toggle favorites'),
visibility: 'hidden',
index: 0,
},
{
id: 'privacyStats',
title: 'Privacy Stats',
icon: 'shield',
toggle: noop('toggle favorites'),
visibility: 'visible',
index: 1,
},
]}
/>
</MaxContent>
</Fragment>
),
},
...otherPrivacyStatsExamples,
...otherRMFExamples,
...customizerExamples,
...updateNotificationExamples,
};

function MaxContent({ children }) {
return <div style={{ display: 'grid', gridTemplateColumns: 'max-content' }}>{children}</div>;
}
2 changes: 1 addition & 1 deletion special-pages/pages/new-tab/app/components/Icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from './Icons.module.css';

export function ChevronButton() {
return (
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" class={styles.chevron}>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" class={styles.chevronButton}>
<rect fill="black" fill-opacity="0.06" width="24" height="24" rx="12" class={styles.chevronCircle} />
<path
fill="black"
Expand Down
9 changes: 3 additions & 6 deletions special-pages/pages/new-tab/app/components/Icons.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.chevron {
.chevronButton {
&:hover .chevronCircle {
fill: black;
fill-opacity: 0.06;

@media screen and (prefers-color-scheme: dark) {
fill: white;
fill-opacity: 0.12
fill-opacity: 0.12;
}
}
}
Expand All @@ -18,11 +18,8 @@
.chevronArrow {
@media screen and (prefers-color-scheme: dark) {
fill: white;
fill-opacity: 0.5
fill-opacity: 0.5;
}
}

.customize {

}

Loading
Loading