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: Move from brave-ui to brave-core #2857

Merged
merged 43 commits into from
Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
327edf8
Imported from brave-ui: Changes structure of the project
NejcZdovc Jul 24, 2018
01c954c
Imported from brave-ui: Adds TS lint for storybook
NejcZdovc Jul 24, 2018
c49feea
Imported from brave-ui: Fixes center problem and lagging when switching
NejcZdovc Jul 26, 2018
9172444
Imported from brave-ui: Update all previous non-theme `theme` props t…
petemill Aug 21, 2018
c075e56
Imported from brave-ui: Update UI and remove legacy props from privat…
cezaraugusto Sep 7, 2018
0b90bfe
Imported from brave-ui: make newtab feature-components export ready
cezaraugusto Sep 10, 2018
97d41a2
Imported from brave-ui: replace styled-components theme import with o…
cezaraugusto Sep 11, 2018
1f0609f
Imported from brave-ui: replace styled import with our own. improve i…
cezaraugusto Sep 11, 2018
c4cf52b
Imported from brave-ui: tweak private tab behavior per design
cezaraugusto Sep 17, 2018
f51f295
Imported from brave-ui: Wording Tweaks
rossmoody Sep 17, 2018
76da489
Imported from brave-ui: private tabs v3
cezaraugusto Oct 15, 2018
6c2a9f1
Imported from brave-ui: Style and Infostrings
rossmoody Oct 15, 2018
b6ebdc0
Imported from brave-ui: Tiny locale
rossmoody Oct 15, 2018
5937ea6
Imported from brave-ui: Mass Locale Updates
rossmoody Oct 16, 2018
de7c630
Imported from brave-ui: remove modals, update links
cezaraugusto Oct 16, 2018
09a98ae
Imported from brave-ui: updates
rossmoody Oct 16, 2018
34557bd
Imported from brave-ui: 1 number
rossmoody Oct 16, 2018
ce1bb41
Imported from brave-ui: add back the stats components
cezaraugusto Oct 16, 2018
ff74bbe
Imported from brave-ui: tweaks for private window mockup
cezaraugusto Oct 16, 2018
72678f3
Imported from brave-ui: add missing prop to fakeButton in private tab
cezaraugusto Oct 16, 2018
e9a2804
Imported from brave-ui: Remaining NTP Updates
rossmoody Dec 15, 2018
6d814bb
Imported from brave-ui: newtab page
cezaraugusto Oct 21, 2018
fb8f181
Imported from brave-ui: Style & Formatting 1.0
rossmoody Oct 23, 2018
7833016
Imported from brave-ui: parity with brave-core
cezaraugusto Jan 9, 2019
1b263cd
Imported from brave-ui: move clock component to features/newtab
cezaraugusto Jan 11, 2019
446b96e
Imported from brave-ui: Fix clock component path
Jan 14, 2019
9072f7f
Imported from brave-ui: Additional stying
Jan 14, 2019
62be1f7
Imported from brave-ui: Fixes
Jan 14, 2019
6020dc2
Imported from brave-ui: Update index.ts
Feb 13, 2019
ca83923
Imported from brave-ui: update topsite tile click area
Feb 28, 2019
9911c1e
Imported from brave-ui: 🐛Update NTP display for RTL locale displays
imptrx May 17, 2019
cb3994c
Imported from brave-ui: ✨ Add new user flow for changing background …
imptrx Jun 4, 2019
aab86a7
Imported from brave-ui: Revert "Merge pull request #485 from brave/to…
NejcZdovc Jun 5, 2019
a97cf11
Imported from brave-ui: Undo revert of https://github.com/brave/brave…
cezaraugusto Jun 5, 2019
046512d
Imported from brave-ui: ✨ Put back gradient to cover for loading image
imptrx Jun 12, 2019
9e5051a
Imported from brave-ui: 💄 Adjust media query boundaries to account fo…
imptrx Jun 27, 2019
7808dd4
Imported from brave-ui: ✨ Make widgets toggleable via new HOC
imptrx Jun 20, 2019
d45d291
Imported from brave-ui: 🐛 Fix default exports
imptrx Jun 20, 2019
88ce14e
Imported from brave-ui: 💄 Revert cosmetic update so top sites are res…
imptrx Jul 2, 2019
3d3ca87
NTP WebUI: Reclassify existing components as containers
petemill Jul 2, 2019
8034a6c
Typescript: Include .webp as a non-js-loader
petemill Jul 3, 2019
86fa200
New Tab Page WebUI: Move brave-ui paths to brave-core paths
petemill Jul 2, 2019
385e959
Introduce Storybook, beginning with New Tab Page
petemill Jul 3, 2019
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
8 changes: 8 additions & 0 deletions .storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
23 changes: 23 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

// for docs see https://github.com/echoulen/storybook-addon-styled-component-theme
import 'storybook-addon-styled-component-theme/dist/src/register'

// for docs see https://www.npmjs.com/package/@storybook/addon-backgrounds
import '@storybook/addon-backgrounds/register'

// for docs see https://github.com/storybooks/storybook/tree/master/addons/actions
import '@storybook/addon-actions/register'

// for docs see https://github.com/storybooks/storybook/tree/master/addons/knobs
import '@storybook/addon-knobs/register'

// for docs see https://github.com/storybooks/storybook/tree/master/addons/options
import '@storybook/addon-options/register'

// for docs see https://github.com/dump247/storybook-state
// this addon is surfacing in every panel ATM. this is a bug. track it here:
// https://github.com/dump247/storybook-state/pull/12
// import '@dump247/storybook-state/register'
40 changes: 40 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { withBackgrounds } from '@storybook/addon-backgrounds'
import { configure, addDecorator, addParameters } from '@storybook/react'
import { withOptions } from '@storybook/addon-options'
import { initLocale } from 'brave-ui/helpers'
import locale from './locale'
import { withThemesProvider } from 'storybook-addon-styled-component-theme'
import DarkTheme from 'brave-ui/theme/brave-dark'
import DefaultTheme from 'brave-ui/theme/brave-default'

// Fonts
import '../ui/webui/resources/fonts/muli.css'
import '../ui/webui/resources/fonts/poppins.css'

const themes = [DefaultTheme, DarkTheme]
addDecorator(withThemesProvider(themes))

addParameters({
backgrounds: [
{ name: 'Neutral300', value: '#DEE2E6', default: true },
{ name: 'Grey700', value: '#5E6175' },
{ name: 'White', value: '#FFF' },
{ name: 'Grey900', value: '#1E2029' }
]
})

addParameters({
options: {
name: 'Brave Browser UI',
url: 'https://github.com/brave/brave-core',
panelPosition: 'right'
}
})

function loadStories() {
initLocale(locale)
const req = require.context('../components/', true, /\/stories\/.*\.tsx$/)
req.keys().forEach(filename => req(filename))
}

configure(loadStories, module)
223 changes: 223 additions & 0 deletions .storybook/locale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License. v. 2.0. If a copy of the MPL was not distributed with this file.
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const locale: Record<string, string> = {
about: 'about',
accept: 'Accept',
activityCopy: '©2016 –2018 Brave Software. Brave is a registered trademark of Brave Software. Site names may be trademarks or registered trademarks of the site owner.',
activityNote: 'To protect your privacy, this Brave Rewards statement is not saved, recorded or logged anywhere other than on your device (this computer). It cannot be retrieved from Brave in the event of data loss on your device.',
addFunds: 'add funds',
addFundsFAQ: 'the FAQ',
addFundsNote: 'Reminder: The Brave Wallet is unidirectional and BAT flows to publisher sites. For more information about Brave Payments, please visit',
addFundsQR: 'Show QR Code',
addFundsText: 'Be sure to use the address below that matches the type of cryto you own. It will be converted automatically to BAT by Uphold and appear as an increased balance in your Brave Rewards wallet. Please allow up to one hour for your wallet balance to update.',
addFundsTitle: 'Send cryptocurrency from your external account to your Brave Rewards wallet.',
allowTip: 'Allow tips on',
amount: 'Amount',
autoTipText: 'You are automatically sending a tip to:',
backup: 'Backup',
backupNow: 'Backup Now',
backupWalletTitle: 'Backup Wallet',
bat: 'BAT',
braveAdsDesc: 'No action required. Just collect tokens. Your data is safe with our Shields.',
braveAdsTitle: 'Brave Ads',
braveContributeDesc: 'Set budget and browse normally. Your favorite sites get paid automatically.',
braveContributeTitle: 'Auto-Contribute',
braveRewards: 'Brave Rewards',
braveRewardsDesc: 'Earn tokens for viewing privacy-respecting ads, and pay it forward by supporting content creators you love!',
braveRewardsOptInText: 'Yes, I\'m In!',
braveRewardsSubTitle: 'Get Rewarded for Browsing!',
braveRewardsTeaser: 'How it works...',
braveRewardsTitle: 'Brave Rewards',
braveVerified: 'Brave Verified Publishers',
cancel: 'Cancel',
captchaDrag: 'Drag the BAT Icon on to the',
captchaLuckyDay: 'It’s your lucky day!',
captchaOnTheWay: 'Your token grant is on its way.',
captchaProveHuman: 'Prove that you are human!',
captchaTarget: 'target.',
captchaMissedTarget: 'Hmm… Not Quite. Try Again.',
claim: 'Claim',
closeBalance: 'Closing Balance',
contribute: 'Contribute',
contributeAllocation: 'Auto-Contribute Allocation',
contributeTooltip: 'Auto-Contribute Settings',
copy: 'Copy',
currentDonation: 'You’re currently donating {{currentDonation}} BAT to this site every month.',
braveRewardsCreatingText: 'Creating wallet',
date: 'Date',
deposit: 'Deposit',
deposits: 'Deposits',
description: 'Description',
disabledPanelOff: 'Off',
disabledPanelSettings: 'Settings.',
disabledPanelPrivateText: 'Brave Rewards is not available while in a Private Window.',
disabledPanelText: 'You are not currently accruing any Rewards benefits while browsing. Turn Rewards back on in',
disabledPanelTitle: 'Brave Rewards is',
dndCaptchaText1: 'Drag and drop the token logo onto the',
dndCaptchaText2: 'target',
donation: 'Donation',
donationAmount: 'Donation amount',
donateMonthly: 'Tip this site Monthly',
donateNow: 'Send a tip…',
donationFailureMsg: 'Looks like something went wrong. Please try again later.',
donationSent: 'Donation Sent!',
donationTips: 'Donation & Tips',
done: 'Done',
doMonthly: 'Set recurring donation',
downloadPDF: 'Download as PDF',
earningsAds: 'Earnings from Ads',
earningsClaimBat: 'BAT,',
earningsClaimDefault: 'Your Ads earnings are available.',
earningsClaimOne: 'Your Ads earnings,',
earningsClaimTwo: 'are available.',
enableTips: 'Enable Tips',
excludeSite: 'Exclude this site',
excludedSitesText: 'Sites excluded from Auto-Contributions:',
expiresOn: 'expires on',
firstTipDateText: 'Your first monthly tip will be sent on:',
for: 'for',
grants: 'Grants',
grantDisclaimer: 'Unused tokens by the expiration date will be automatically returned to the Brave User Growth Pool.',
grantExpire: 'Grant Expiration Date',
import: 'import',
includeInAuto: 'Include in Auto-Contribute',
learnMore: 'Learn More',
makeMonthly: 'Make this monthly',
manageWallet: 'Manage Your Wallet',
monthApr: 'Apr',
monthAug: 'August',
monthDec: 'December',
monthFeb: 'February',
monthJan: 'January',
monthJul: 'July',
monthJun: 'June',
monthMar: 'March',
monthMay: 'May',
monthNov: 'November',
monthOct: 'October',
monthSep: 'September',
monthlyText: 'Monthly',
monthlyTips: 'Monthly Tips!',
newGrant: 'A free token grant is available.',
newTokenGrant: 'New Token Grant',
noActivity: 'No activities yet…',
noGrants: 'Currently no token grant is available.',
notEnoughTokens: 'Not enough tokens. Please',
noThankYou: 'No, thank you',
off: 'off',
ok: 'ok',
on: 'on',
oneTime: 'One time',
oneTimeDonation: 'One-time Tips',
openBalance: 'Opening Balance',
payment: 'Payment',
paymentMonthly: 'Payment made every {{day}}th day in each month.',
paymentNotMade: 'Payment not made.',
paymentWarning: 'When your balance is not enough to cover the combined total of Auto-Contribute and the recurring donations, these payments are skipped for the period.',
pinnedSitesHeader: 'Pinned sites are now',
pinnedSitesMsg: 'Here\'s how monthly tips work:',
pinnedSitesOne: 'Monthly tips do not come out of your Auto-Contribute payment. They\'re separate.',
pinnedSitesTwo: 'Each site is paid a fixed amount monthly.',
pinnedSitesThree: 'Monthly tips are paid out all at once, each month. If you\'re using Auto-Contribute, tips go out at the same time as your monthly Auto-Contribute payment.',
pinnedSitesFour: 'You can remove any site receiving monthly tips from inside of the Tips panel.',
pleaseNote: 'Please note:',
print: 'Print',
readyToTakePart: 'Ready to get started?',
readyToTakePartOptInText: 'Yes I\'m Ready!',
readyToTakePartStart: 'You can start with the',
recoveryKeys: 'Recovery Key',
recurring: 'Recurring',
recurringDonation: 'Recurring Donation',
recurringDonations: 'Monthly Tips',
remove: 'remove',
reservedAmountText: 'You’ve designated {{reservedAmount}} BAT for creators who haven’t yet signed up to receive contributions. We’ll keep trying to contribute until they verify, or until 90 days have passed.',
reservedMoreLink: 'Learn more.',
restore: 'Restore',
restoreAll: 'Restore All',
reviewSitesMsg: 'Your pinned sites have been moved to',
rewardsBackupText1: 'Backup your Wallet',
rewardsBackupText2: 'Keep this recovery key safe.',
rewardsBackupText3: 'You can always use this key to get your wallet back if something happens to your browser or computer. But make sure to protect it — anyone who gets this key could steal your wallet. It\'s probably safest to write it down on a piece of paper, or wherever else you keep important info.',
rewardsBannerText1: 'Thanks for stopping by. We joined Brave’s vision of protecting your privacy because we believe that fans like you would support us in our effort to keep the web a clean and safe place to be.',
rewardsBannerText2: 'Your donation is much appreciated and it encourages us to continue to improve our content.',
rewardsContribute: 'Auto-Contribute',
rewardsContributeAttention: 'Attention',
rewardsContributeAttentionScore: 'Attention',
rewardsContributeText1: 'You’re currently supporting',
rewardsOffText1: 'Do you know that you’ve been paying for the web content with your data for the digital ads? You didn’t have a voice in it and worse, you’re exposed to privacy and security risks.',
rewardsOffText2: 'Brave Rewards allows you to take control back.',
rewardsOffText3: 'How does it work?',
rewardsOffText4: 'Your attention is valuable. Get paid for the ads. And pay directly the favorite content creators at your will. That way, they can grow and continue delivering the content that delights you.',
rewardsPanelEmptyText1: 'Sadly, no tokens yet.',
rewardsPanelEmptyText2: '3 ways to fill your wallet:',
rewardsPanelEmptyText3: 'You can add funds.',
rewardsPanelEmptyText4: 'You can earn tokens from Brave Ads.',
rewardsPanelEmptyText5: 'Occasionally, you will also received token grants from Brave. So keep an eye out for the alert!',
rewardsPanelOffText1: 'Get Rewarded for Browsing!',
rewardsPanelOffText2: 'Earn tokens for your attention to ads and pay it forward to support content creators you value!',
rewardsPanelText1: 'Add, withdraw and manage funds at',
rewardsPanelText2: 'Brave wallet is managed by',
rewardsPanelText3: 'Brave Rewards is built on the Basic Attention Token. Learn more about BAT',
rewardsPanelText4: 'here',
rewardsRestoreText1: 'Restore your Wallet',
rewardsRestoreText2: 'Use your recovery key to restore your wallet.',
rewardsRestoreText3: 'Restoring with a recovery key will replace your current wallet. So make sure you empty or back up your current wallet before restoring.',
rewardsRestoreText4: 'Enter your recovery key or',
rewardsSummary: 'Rewards Summary',
rewardsWhy: 'Why Brave Rewards…',
saveAsFile: 'Save',
seeAllItems: 'See all {{numItems}} items',
seeAllSites: 'See all {{numSites}} sites',
sendDonation: 'Send my donation',
sendTip: 'Send my Tip',
settings: 'Settings',
site: 'site',
siteBannerNoticeNote: 'NOTE:',
siteBannerNoticeText: 'This creator has not yet verified their site. As soon as they verify with Brave, they will receive your tip.',
sites: 'sites',
thankYou: 'Thank You!',
tipOnLike: 'Tip on like',
tipText: 'You\'ve just sent a tip to:',
titleBAT: 'Basic Attention token (BAT)',
titleBTC: 'BitCoin (BTC)',
titleETH: 'Etherium (ETH)',
titleLTC: 'Lite Coin (LTC)',
tokenGrant: 'Token Grants',
tokenGrantClaimed: 'Token Grants Claimed',
tokens: 'tokens',
total: 'Total',
transactions: 'Transactions',
turnOnRewardsDesc: 'This enables both Brave Ads and Auto-Contribute. You can always opt out each any time.',
turnOnRewardsTitle: 'Turn on Rewards',
type: 'Type',
uhOh: 'Uh oh…',
unVerifiedPublisher: 'Not yet verified',
unVerifiedText: 'This creator has not yet signed up to receive contributions from Brave users.',
unVerifiedTextMore: 'Learn more.',
verifiedPublisher: 'Brave Verified Publisher',
viewDetails: 'View Details',
viewMonthly: 'View Monthly Statement for Details',
walletActivity: 'Wallet Activity',
walletAddress: 'Wallet Address',
walletBalance: 'wallet balance',
walletFailedButton: 'Re-try',
walletFailedTitle: 'Wallet creation failed',
walletFailedText: 'Please check your internet connection.',
welcome: 'Welcome!',
welcomeButtonTextOne: 'Start Earning Now!',
welcomeButtonTextTwo: 'Join Rewards',
welcomeDescOne: 'You can now earn tokens for watching privacy focused Brave Ads. Your contribution stays the same.',
welcomeDescTwo: 'Earn tokens for watching Ads and pay it forward to your favorite content creators.',
welcomeFooterTextOne: 'Check out what’s improved',
welcomeFooterTextTwo: 'Learn More',
welcomeHeaderOne: 'Brave Payments is now Brave Rewards with many upgrades.',
welcomeHeaderTwo: 'You are about to start a very Brave way to browse the web.',
whyBraveRewards: 'Why Brave Rewards?',
whyBraveRewardsDesc1: 'With conventional browsers, you pay to browse the web by viewing ads with your valuable attention, spending your valuable time downloading invasive ad technology, that transmits your valuable private data to advertisers — without your consent.',
whyBraveRewardsDesc2: 'Well, you\'ve come to the right place. Brave welcomes you to the new internet. One where your time is valued, your personal data is kept private, and you actually get paid for your attention.',
yourWallet: 'Your wallet'
}

export default locale
35 changes: 35 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const path = require('path')

const createStyledComponentsTransformer = require('typescript-plugin-styled-components')
.default

function getStyledComponentDisplay (filename, bindingName) {
return bindingName
}

// Export a function. Accept the base config as the only param.
module.exports = async ({ config, mode }) => {
// Make whatever fine-grained changes you need
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve('awesome-typescript-loader'),
options: {
configFileName: path.resolve(__dirname, '..', 'tsconfig-storybook.json'),
getCustomTransformers: () => ({
before: [
createStyledComponentsTransformer({
options: {
getDisplayName: getStyledComponentDisplay
}
})
]
})
}
})
config.resolve.alias = {
...config.resolve.alias,
'brave-ui': path.resolve(__dirname, '../node_modules/brave-ui/src')
}
config.resolve.extensions.push('.ts', '.tsx')
return config
}
2 changes: 1 addition & 1 deletion components/brave_new_tab_ui/brave_new_tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as dataFetchAPI from './api/dataFetch'
import * as preferencesAPI from './api/preferences'

// Components
import App from './components/app'
import App from './containers/app'

// Utils
import store from './store'
Expand Down
Loading