Skip to content

Commit

Permalink
Merge branch 'main' of github.com:duckduckgo/content-scope-scripts in…
Browse files Browse the repository at this point in the history
…to vkraucunas/ntp-remotemessagingframwork-fe
  • Loading branch information
vkraucunas committed Oct 17, 2024
2 parents e1ac641 + f80f4e2 commit ac3c681
Showing 1 changed file with 0 additions and 94 deletions.
94 changes: 0 additions & 94 deletions special-pages/pages/new-tab/app/components/Components.jsx
Original file line number Diff line number Diff line change
@@ -1,94 +1,8 @@
import { Fragment, h } from "preact";
import styles from "./Components.module.css";
import { mainExamples, otherExamples } from "./Examples.jsx";
import { Body, Heading, PrivacyStatsConsumer } from "../privacy-stats/PrivacyStats.js";

import { PrivacyStatsMockProvider } from "../privacy-stats/mocks/PrivacyStatsMockProvider.js";
import { stats } from "../privacy-stats/mocks/stats.js";
import { RemoteMessagingFramework } from "../remote-messaging-framework/RemoteMessagingFramework";

/** @type {Record<string, {factory: () => import("preact").ComponentChild}>} */
const examples = {
'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} />
},
'stats.heading': {
factory: () => <Heading trackerCompanies={stats.few.trackerCompanies} totalCount={stats.few.totalCount} />
},
'stats.heading.none': {
factory: () => <Heading trackerCompanies={stats.none.trackerCompanies} totalCount={stats.none.totalCount} />
},
'rmf-small': {
factory: () => (
<RemoteMessagingFramework
messageType="small"
titleText="Small title"
descriptionText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget elit vel ex dapibus."
/>)
},
'rmf-medium': {
factory: () => (
<RemoteMessagingFramework
messageType="medium"
icon="Announce"
titleText="Medium title"
descriptionText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget elit vel ex dapibus."
/>)
},
'rmf-big-single-action': {
factory: () => (
<RemoteMessagingFramework
messageType="big_single_action"
icon="AppUpdate"
titleText="Big one button title"
descriptionText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget elit vel ex dapibus."
primaryActionText="Take Survey"
primaryAction={() => { }}
/>)
},
'rmf-big-two-action': {
factory: () => (
<RemoteMessagingFramework
messageType="big_two_action"
icon="CriticalUpdate"
titleText="Big 2 buttons title"
descriptionText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget elit vel ex dapibus."
primaryActionText="Take Survey"
primaryAction={() => { }}
secondaryActionText="Remind Me Later"
secondaryAction={() => { }}
/>)
},
'rmf-big-two-action-overflow': {
factory: () => (
<RemoteMessagingFramework
messageType="big_two_action"
icon="DDGAnnounce"
titleText="Big 2 buttons with long titles"
descriptionText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget elit vel ex dapibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget elit vel ex dapibus."
primaryActionText="How to update Windows with every step fully explained"
primaryAction={() => { }}
secondaryActionText="Remind me later, but only if I’m actually going to update soon"
secondaryAction={() => { }}
/>)
}
}

const url = new URL(window.location.href);

export function Components() {
Expand All @@ -98,14 +12,6 @@ export function Components() {
const entries = Object.entries(examples);
const filtered = id && valid
? entries.filter(([_id]) => _id === id)
const e2e = url.searchParams.has("e2e");
const entries = Object.entries(mainExamples).concat(Object.entries(otherExamples));
const entryIds = entries.map(([id]) => id);

const validIds = ids.filter(id => entryIds.includes(id));

const filtered = validIds.length
? validIds.map((id) => /** @type {const} */([id, mainExamples[id] || otherExamples[id]]))
: entries

if (isolated) {
Expand Down

0 comments on commit ac3c681

Please sign in to comment.