-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Tab Page and NTP Widget styles (#1229)
* fix: NextSteps bubble position, rm the unused mock provider * chore: Add RMF to default page, adjust NextSteps styels * chore: Add common border radii 4, 6, 8, 12px * fix: tests, first attempt * reverting adding the RMF to the default page * feat: Add hover show/hide on NExtSteps * chore: Add focus ring consistency * chore: Update text colors to use ntp theme values * chore: remove unneeded css * wip * fix: file names * fix: bubble location * fix: addAppToDockMac NextSteps variant * chore: Add 0 gap option to Stack, use in WidgetList * chore: remove ShowHideButtonWithText, update ShowHideButton to handle full width and round variations * chore: Update ChevronButton Icon * chore: Add long title option to the Favorites data * chore: Adjust widget spacing values * chore: A few cleanups * chore: Reorg RMF * chore: Reorg PrivacyStats * fix: PrivacyStats reorg * chore: Reorg Customizer * chore: Update Examples * fix: Favorites tests * chore: Add type info to the Examples in each widget * fix: Examples view * fix: Component item relative to contain absolutely positioned items * chore: Rename example files consistently * chore: UpdateNotification added to correct space, switched to DismissButton usage * fix: lint * chore: Remove unneeded color * chore: Add a gap var to the ntp-theme css and apply across widgets * rebase bugfix * chore: Fix rmf spacing * fix: Favorites test * fix: thin focus ring --------- Co-authored-by: Shane Osbourne <sosbourne@duckduckgo.com>
- Loading branch information
1 parent
a53559e
commit c9f7798
Showing
46 changed files
with
535 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 13 additions & 161 deletions
174
special-pages/pages/new-tab/app/components/Examples.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.