diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index 23f73da8cd8e..4e47bf1708f0 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -109,6 +109,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, content::WebUIDataSource* { "estimatedTimeSaved", IDS_BRAVE_NEW_TAB_TOTAL_TIME_SAVED }, { "thumbRemoved", IDS_BRAVE_NEW_TAB_THUMB_REMOVED }, { "undoRemoved", IDS_BRAVE_NEW_TAB_UNDO_REMOVED }, + { "close", IDS_BRAVE_NEW_TAB_CLOSE }, { "restoreAll", IDS_BRAVE_NEW_TAB_RESTORE_ALL }, { "second", IDS_BRAVE_NEW_TAB_SECOND }, { "seconds", IDS_BRAVE_NEW_TAB_SECONDS }, diff --git a/components/brave_new_tab_ui/BUILD.gn b/components/brave_new_tab_ui/BUILD.gn index ad70623767f9..66290558236a 100644 --- a/components/brave_new_tab_ui/BUILD.gn +++ b/components/brave_new_tab_ui/BUILD.gn @@ -2,26 +2,28 @@ import("//brave/components/common/typescript.gni") transpile_web_ui("brave_new_tab_ui") { inputs = [ - "brave_new_tab.html", - "brave_new_tab.tsx", - "storage.ts", - "store.ts", "actions/new_tab_actions.ts", - "components/app.tsx", - "components/block.tsx", - "components/footerInfo.tsx", - "components/siteRemovalNotification.tsx", - "components/stats.tsx", + "components/newTab/block.tsx", + "components/newTab/footerInfo.tsx", + "components/newTab/index.tsx", + "components/newTab/notification.tsx", + "components/newTab/stats.tsx", "components/privateTab/index.tsx", "components/privateTab/privateTab.tsx", "components/privateTab/qwantTab.tsx", "components/privateTab/qwantTorTab.tsx", + "components/privateTab/torContent.tsx", "components/privateTab/torTab.tsx", + "components/app.tsx", "constants/backgrounds.ts", "constants/new_tab_types.ts", - "constants/theme.ts", "reducers/index.ts", "reducers/new_tab_reducer.tsx", + "api.ts", + "brave_new_tab.html", + "brave_new_tab.tsx", + "storage.ts", + "store.ts" ] entry_points = [ diff --git a/components/brave_new_tab_ui/actions/new_tab_actions.ts b/components/brave_new_tab_ui/actions/new_tab_actions.ts index 46a296c41ded..740c7de9df48 100644 --- a/components/brave_new_tab_ui/actions/new_tab_actions.ts +++ b/components/brave_new_tab_ui/actions/new_tab_actions.ts @@ -11,8 +11,6 @@ export const topSitesDataUpdated = (topSites: NewTab.Site[]) => action(types.NEW topSites }) -export const backgroundImageLoadFailed = () => action(types.NEW_TAB_BACKGROUND_IMAGE_LOAD_FAILED) - export const bookmarkAdded = (url: string) => action(types.BOOKMARK_ADDED, { url }) diff --git a/components/brave_new_tab_ui/api.ts b/components/brave_new_tab_ui/api.ts index 514d5e8eb146..1f7a8bc3b064 100644 --- a/components/brave_new_tab_ui/api.ts +++ b/components/brave_new_tab_ui/api.ts @@ -73,7 +73,7 @@ export const getGridSites = (state: NewTab.State, checkBookmarkInfo?: boolean) = gridSites.forEach((gridSite: NewTab.Site) => { gridSite.letter = getLetterFromSite(gridSite) gridSite.thumb = `chrome://thumb/${gridSite.url}` - gridSite.favicon = `chrome://favicon/size/48@1x/${gridSite.url}` + gridSite.favicon = `chrome://favicon/size/64@1x/${gridSite.url}` gridSite.bookmarked = state.bookmarks[gridSite.url] if (checkBookmarkInfo && !gridSite.bookmarked) { diff --git a/components/brave_new_tab_ui/brave_new_tab.tsx b/components/brave_new_tab_ui/brave_new_tab.tsx index 9f49dcad9f8d..2052d23999a4 100644 --- a/components/brave_new_tab_ui/brave_new_tab.tsx +++ b/components/brave_new_tab_ui/brave_new_tab.tsx @@ -16,6 +16,11 @@ import App from './components/app' // Utils import store from './store' import * as newTabActions from './actions/new_tab_actions' +import 'emptykit.css' + +// Fonts +import '../fonts/poppins.css' +import '../fonts/muli.css' window.cr.define('brave_new_tab', function () { 'use strict' diff --git a/components/brave_new_tab_ui/components/app.tsx b/components/brave_new_tab_ui/components/app.tsx index ab86790607b9..0f8cac0a82c6 100644 --- a/components/brave_new_tab_ui/components/app.tsx +++ b/components/brave_new_tab_ui/components/app.tsx @@ -3,195 +3,33 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react' -import { DragDropContext } from 'react-dnd' import { bindActionCreators, Dispatch } from 'redux' import { connect } from 'react-redux' -import HTML5Backend from 'react-dnd-html5-backend' -import { Clock } from 'brave-ui/old' // Components -import Stats from './stats' -import Block from './block' -import FooterInfo from './footerInfo' -import SiteRemovalNotification from './siteRemovalNotification' -import NewPrivateTab from './privateTab' - -// Constants -import { theme } from '../constants/theme' +import NewPrivateTabPage from './privateTab' +import NewTabPage from './newTab' // Utils import * as newTabActions from '../actions/new_tab_actions' -// Assets -require('../../styles/newtab.less') -require('../../fonts/poppins.css') -require('../../fonts/muli.css') - interface Props { actions: any newTabData: NewTab.State } -class NewTabPage extends React.Component { - get actions () { - return this.props.actions - } - - get showImages () { - return this.props.newTabData.showImages && !!this.props.newTabData.backgroundImage - } - - get useAlternativePrivateSearchEngine () { - return ( - this.props.newTabData && - this.props.newTabData.useAlternativePrivateSearchEngine - ) - } - - onDraggedSite = (fromUrl: string, toUrl: string, dragRight: boolean) => { - this.actions.siteDragged(fromUrl, toUrl, dragRight) - } - - onDragEnd = (url: string, didDrop: boolean) => { - this.actions.siteDragEnd(url, didDrop) - } - - onToggleBookmark (site: NewTab.Site) { - if (site.bookmarked === undefined) { - this.actions.bookmarkAdded(site.url) - } else { - this.actions.bookmarkRemoved(site.url) - } - } - - onHideSiteRemovalNotification = () => { - this.actions.onHideSiteRemovalNotification() - } - - onTogglePinnedTopSite (site: NewTab.Site) { - if (!site.pinned) { - this.actions.sitePinned(site.url) - } else { - this.actions.siteUnpinned(site.url) - } - } - - onIgnoredTopSite (site: NewTab.Site) { - this.actions.siteIgnored(site.url) - } - - onUndoIgnoredTopSite = () => { - this.actions.undoSiteIgnored() - } - - /** - * Clear ignoredTopSites and pinnedTopSites list - */ - onUndoAllSiteIgnored = () => { - this.actions.undoAllSiteIgnored() - } - - /** - * This handler only fires when the image fails to load. - * If both the remote and local image fail, page defaults to gradients. - */ - onBackgroundImageLoadFailed = () => { - this.actions.backgroundImageLoadFailed() - } - - onChangePrivateSearchEngine = (e: React.ChangeEvent) => { - if (!e.target) { - return - } - this.actions.changePrivateSearchEngine(e.target.checked) - } - +class DefaultPage extends React.Component { render () { - const { newTabData } = this.props + const { newTabData, actions } = this.props // don't render if user prefers an empty page if (this.props.newTabData.showEmptyPage && !this.props.newTabData.isIncognito) { - return
+ return
} - if (this.props.newTabData.isIncognito) { - return ( - - ) - } - - // don't render until object is found - if (!this.props.newTabData) { - return null - } - - const backgroundProps: Partial = {} - const bgImage: NewTab.Image | undefined = this.props.newTabData.backgroundImage - let gradientClassName = 'gradient' - if (this.showImages && bgImage) { - backgroundProps.style = bgImage.style - gradientClassName = 'bgGradient' - } - return ( -
- { - this.showImages && bgImage - ? - : null - } -
-
-
-
-
- -
-
- -
-
-
- -
-
- { - this.props.newTabData.showSiteRemovalNotification - ? - : null - } - -
-
- ) + return this.props.newTabData.isIncognito + ? + : } } @@ -206,4 +44,4 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ export default connect( mapStateToProps, mapDispatchToProps -)(DragDropContext(HTML5Backend)(NewTabPage)) +)(DefaultPage) diff --git a/components/brave_new_tab_ui/components/footerInfo.tsx b/components/brave_new_tab_ui/components/footerInfo.tsx deleted file mode 100644 index 9d68591ecfc9..000000000000 --- a/components/brave_new_tab_ui/components/footerInfo.tsx +++ /dev/null @@ -1,59 +0,0 @@ -/* 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/. */ - -import * as React from 'react' -import { getLocale } from '../../common/locale' - -interface Props { - backgroundImage?: NewTab.Image -} - -export default class FooterInfo extends React.Component { - render () { - const bgImage: NewTab.Image | undefined = this.props.backgroundImage - - return ( - - ) - } -} diff --git a/components/brave_new_tab_ui/components/block.tsx b/components/brave_new_tab_ui/components/newTab/block.tsx similarity index 71% rename from components/brave_new_tab_ui/components/block.tsx rename to components/brave_new_tab_ui/components/newTab/block.tsx index 510162d62105..5c78a1c8b779 100644 --- a/components/brave_new_tab_ui/components/block.tsx +++ b/components/brave_new_tab_ui/components/newTab/block.tsx @@ -16,8 +16,11 @@ import { DropTargetSpec } from 'react-dnd' -// Utils -import { cx } from '../../common/classSet' +// Feature-specific components +import { Tile, TileActionsContainer, TileAction, TileFavicon } from 'brave-ui/features/newTab/default' + +// Icons +import { PinIcon, BookmarkOIcon, BookmarkIcon, CloseStrokeIcon } from 'brave-ui/components/icons' const Types = { BLOCK: 'block' @@ -120,54 +123,33 @@ class Block extends React.Component { style, favicon } = this.props - const starIcon = isBookmarked ? 'bookmark' : 'bookmark-o' - const pinIcon = isPinned ? 'pin' : 'pin-o' + const starIcon = isBookmarked ? : + const pinIcon = return connectDragSource( connectDropTarget( -
- ) ) diff --git a/components/brave_new_tab_ui/components/newTab/footerInfo.tsx b/components/brave_new_tab_ui/components/newTab/footerInfo.tsx new file mode 100644 index 000000000000..13eec65ad7b7 --- /dev/null +++ b/components/brave_new_tab_ui/components/newTab/footerInfo.tsx @@ -0,0 +1,52 @@ +/* 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/. */ + +import * as React from 'react' + +// Feature-specific components +import { Link, Navigation, IconLink, PhotoName } from 'brave-ui/features/newTab/default' + +// Icons +import { SettingsAdvancedIcon, BookmarkBook, HistoryIcon } from 'brave-ui/components/icons' + +// Helpers +import { getLocale } from '../../../common/locale' + +interface Props { + backgroundImageInfo: NewTab.Image | undefined +} + +export default class FooterInfo extends React.Component { + render () { + const { backgroundImageInfo } = this.props + + if (!backgroundImageInfo) { + return null + } + + return ( + <> +
+ + {`${getLocale('photoBy')} `} + + {backgroundImageInfo.author} + + +
+ + + + + + + + + + + + + ) + } +} diff --git a/components/brave_new_tab_ui/components/newTab/index.tsx b/components/brave_new_tab_ui/components/newTab/index.tsx new file mode 100644 index 000000000000..aaaab0be3ce0 --- /dev/null +++ b/components/brave_new_tab_ui/components/newTab/index.tsx @@ -0,0 +1,116 @@ +/* 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/. */ + +import * as React from 'react' +import { DragDropContext } from 'react-dnd' +import HTML5Backend from 'react-dnd-html5-backend' +import { + Page, + Header, + Clock, + Main, + List, + Footer, + DynamicBackground, + Gradient +} from 'brave-ui/features/newTab/default' + +// Components +import Stats from './stats' +import Block from './block' +import FooterInfo from './footerInfo' +import SiteRemovalNotification from './notification' + +interface Props { + actions: any + newTabData: NewTab.State +} + +class NewTabPage extends React.Component { + componentDidMount () { + // if a notification is open at component mounting time, close it + this.props.actions.onHideSiteRemovalNotification() + } + + onDraggedSite = (fromUrl: string, toUrl: string, dragRight: boolean) => { + this.props.actions.siteDragged(fromUrl, toUrl, dragRight) + } + + onDragEnd = (url: string, didDrop: boolean) => { + this.props.actions.siteDragEnd(url, didDrop) + } + + onToggleBookmark (site: NewTab.Site) { + if (site.bookmarked === undefined) { + this.props.actions.bookmarkAdded(site.url) + } else { + this.props.actions.bookmarkRemoved(site.url) + } + } + + onTogglePinnedTopSite (site: NewTab.Site) { + if (!site.pinned) { + this.props.actions.sitePinned(site.url) + } else { + this.props.actions.siteUnpinned(site.url) + } + } + + onIgnoredTopSite (site: NewTab.Site) { + this.props.actions.siteIgnored(site.url) + } + + render () { + const { newTabData, actions } = this.props + + if (!newTabData || !newTabData.backgroundImage) { + return null + } + + return ( + + + +
+ + +
+ + { + this.props.newTabData.gridSites.map((site: NewTab.Site) => + + ) + } + + { + this.props.newTabData.showSiteRemovalNotification + ? + : null + } +
+
+
+ +
+
+
+ ) + } +} + +export default DragDropContext(HTML5Backend)(NewTabPage) diff --git a/components/brave_new_tab_ui/components/newTab/notification.tsx b/components/brave_new_tab_ui/components/newTab/notification.tsx new file mode 100644 index 000000000000..63c4e7398b73 --- /dev/null +++ b/components/brave_new_tab_ui/components/newTab/notification.tsx @@ -0,0 +1,49 @@ +/* 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/. */ + +import * as React from 'react' + +// Feature-specific components +import { + SiteRemovalNotification, + SiteRemovalAction, + SiteRemovalText +} from 'brave-ui/features/newTab/default' + +// Icons +import { CloseStrokeIcon } from 'brave-ui/components/icons' + +// Utils +import { getLocale } from '../../../common/locale' + +interface Props { + actions: any +} + +export default class Notification extends React.Component { + onUndoIgnoredTopSite = () => { + this.props.actions.undoSiteIgnored() + } + + onUndoAllSiteIgnored = () => { + this.props.actions.undoAllSiteIgnored() + } + + onHideSiteRemovalNotification = () => { + this.props.actions.onHideSiteRemovalNotification() + } + + render () { + return ( + + {getLocale('thumbRemoved')} + {getLocale('undoRemoved')} + {getLocale('restoreAll')} + + + + + ) + } +} diff --git a/components/brave_new_tab_ui/components/stats.tsx b/components/brave_new_tab_ui/components/newTab/stats.tsx similarity index 97% rename from components/brave_new_tab_ui/components/stats.tsx rename to components/brave_new_tab_ui/components/newTab/stats.tsx index 83f221017f89..83180379498b 100644 --- a/components/brave_new_tab_ui/components/stats.tsx +++ b/components/brave_new_tab_ui/components/newTab/stats.tsx @@ -3,10 +3,10 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react' -import { StatsContainer, StatsItem } from 'brave-ui/features/newTab' +import { StatsContainer, StatsItem } from 'brave-ui/features/newTab/default' // Utils -import { getLocale } from '../../common/locale' +import { getLocale } from '../../../common/locale' interface Props { stats: NewTab.Stats diff --git a/components/brave_new_tab_ui/components/privateTab/index.tsx b/components/brave_new_tab_ui/components/privateTab/index.tsx index 06e4d7028398..26edda27fe91 100644 --- a/components/brave_new_tab_ui/components/privateTab/index.tsx +++ b/components/brave_new_tab_ui/components/privateTab/index.tsx @@ -5,7 +5,7 @@ import * as React from 'react' // Feature-specific components -import { Page, PageWrapper } from 'brave-ui/features/newTab' +import { Page, PageWrapper } from 'brave-ui/features/newTab/private' // Components group import PrivateTab from './privateTab' @@ -14,40 +14,33 @@ import QwantTorTab from './qwantTorTab' import TorTab from './torTab' interface Props { - isTor: boolean - isQwant: boolean - useAlternativePrivateSearchEngine: boolean - onChangePrivateSearchEngine: (e: React.ChangeEvent) => void + actions: any + newTabData: NewTab.State } -export default class NewPrivateTab extends React.PureComponent { - get currentWindow () { - const { isTor, isQwant, useAlternativePrivateSearchEngine, onChangePrivateSearchEngine } = this.props - if (isTor) { - if (isQwant) { +export default class NewPrivateTabPage extends React.PureComponent { + get currentWindowNewTabPage () { + const { newTabData, actions } = this.props + if (newTabData.isTor) { + if (newTabData.isQwant) { return } return } - if (isQwant) { + if (newTabData.isQwant) { return } - return ( - - ) + return } render () { - const { isTor, isQwant } = this.props + const { isTor, isQwant } = this.props.newTabData return ( - {this.currentWindow} + {this.currentWindowNewTabPage} ) diff --git a/components/brave_new_tab_ui/components/privateTab/privateTab.tsx b/components/brave_new_tab_ui/components/privateTab/privateTab.tsx index 938f9bf11b7a..4d473e6cb361 100644 --- a/components/brave_new_tab_ui/components/privateTab/privateTab.tsx +++ b/components/brave_new_tab_ui/components/privateTab/privateTab.tsx @@ -20,7 +20,7 @@ import { Separator, FakeButton, Link -} from 'brave-ui/features/newTab' +} from 'brave-ui/features/newTab/private' // Components import { Toggle } from 'brave-ui/features/shields' @@ -33,13 +33,26 @@ import { getLocale } from '../../../common/locale' const privateWindowImg = require('../../../img/newtab/private-window.svg') interface Props { - useAlternativePrivateSearchEngine: boolean - onChangePrivateSearchEngine: (e: React.ChangeEvent) => void + actions: any + newTabData: NewTab.State } export default class PrivateTab extends React.PureComponent { + get useAlternativePrivateSearchEngine () { + return ( + this.props.newTabData && + this.props.newTabData.useAlternativePrivateSearchEngine + ) + } + + onChangePrivateSearchEngine = (e: React.ChangeEvent) => { + if (!e.target) { + return + } + this.props.actions.changePrivateSearchEngine(e.target.checked) + } + render () { - const { useAlternativePrivateSearchEngine, onChangePrivateSearchEngine } = this.props return ( @@ -66,8 +79,8 @@ export default class PrivateTab extends React.PureComponent { {getLocale('boxDdgButton')} {getLocale('learnMore')} diff --git a/components/brave_new_tab_ui/components/privateTab/qwantTab.tsx b/components/brave_new_tab_ui/components/privateTab/qwantTab.tsx index 3b571fef9e2b..24d8b282fe8a 100644 --- a/components/brave_new_tab_ui/components/privateTab/qwantTab.tsx +++ b/components/brave_new_tab_ui/components/privateTab/qwantTab.tsx @@ -15,7 +15,7 @@ import { TorImage, Separator, FakeButton -} from 'brave-ui/features/newTab' +} from 'brave-ui/features/newTab/private' import TorContent from './torContent' // Helpers import { getLocale } from '../../../common/locale' diff --git a/components/brave_new_tab_ui/components/privateTab/qwantTorTab.tsx b/components/brave_new_tab_ui/components/privateTab/qwantTorTab.tsx index efc1b91e70c4..a64c87c74b65 100644 --- a/components/brave_new_tab_ui/components/privateTab/qwantTorTab.tsx +++ b/components/brave_new_tab_ui/components/privateTab/qwantTorTab.tsx @@ -17,7 +17,7 @@ import { TorLockImage, Separator, FakeButton -} from 'brave-ui/features/newTab' +} from 'brave-ui/features/newTab/private' // Helpers import { getLocale } from '../../../common/locale' diff --git a/components/brave_new_tab_ui/components/privateTab/torContent.tsx b/components/brave_new_tab_ui/components/privateTab/torContent.tsx index 1865d646f620..d172efc01f02 100644 --- a/components/brave_new_tab_ui/components/privateTab/torContent.tsx +++ b/components/brave_new_tab_ui/components/privateTab/torContent.tsx @@ -10,7 +10,7 @@ import { SubTitle, Text, TorLockImage -} from 'brave-ui/features/newTab' +} from 'brave-ui/features/newTab/private' // Helpers import { getLocale } from '../../../common/locale' diff --git a/components/brave_new_tab_ui/components/privateTab/torTab.tsx b/components/brave_new_tab_ui/components/privateTab/torTab.tsx index 3a05492d70a1..d22c3334c047 100644 --- a/components/brave_new_tab_ui/components/privateTab/torTab.tsx +++ b/components/brave_new_tab_ui/components/privateTab/torTab.tsx @@ -21,7 +21,7 @@ import { Separator, FakeButton, Link -} from 'brave-ui/features/newTab' +} from 'brave-ui/features/newTab/private' // Helpers import { getLocale } from '../../../common/locale' diff --git a/components/brave_new_tab_ui/components/siteRemovalNotification.tsx b/components/brave_new_tab_ui/components/siteRemovalNotification.tsx deleted file mode 100644 index 6aaf457c9e71..000000000000 --- a/components/brave_new_tab_ui/components/siteRemovalNotification.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* 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/. */ - -import * as React from 'react' - -interface Props { - onUndoIgnoredTopSite: () => void - onRestoreAll: () => void - onCloseNotification: () => void -} - -export default class SiteRemovalNotification extends React.Component { - componentDidMount () { - window.i18nTemplate.process(window.document, window.loadTimeData) - } - render () { - const { - onUndoIgnoredTopSite, - onRestoreAll, - onCloseNotification - } = this.props - return ( -
- - - -
- ) - } -} diff --git a/components/brave_new_tab_ui/constants/new_tab_types.ts b/components/brave_new_tab_ui/constants/new_tab_types.ts index 613c07325f6b..a943876fd10b 100644 --- a/components/brave_new_tab_ui/constants/new_tab_types.ts +++ b/components/brave_new_tab_ui/constants/new_tab_types.ts @@ -6,7 +6,6 @@ export const enum types { BOOKMARK_ADDED = '@@newtab/BOOKMARK_ADDED', BOOKMARK_REMOVED = '@@newtab/BOOKMARK_REMOVED', NEW_TAB_TOP_SITES_DATA_UPDATED = '@@newtab/NEW_TAB_TOP_SITES_DATA_UPDATED', - NEW_TAB_BACKGROUND_IMAGE_LOAD_FAILED = '@@newtab/NEW_TAB_BACKGROUND_IMAGE_LOAD_FAILED', NEW_TAB_SITE_PINNED = '@@newtab/NEW_TAB_SITE_PINNED', NEW_TAB_SITE_UNPINNED = '@@newtab/NEW_TAB_SITE_UNPINNED', NEW_TAB_SITE_IGNORED = '@@newtab/NEW_TAB_SITE_IGNORED', diff --git a/components/brave_new_tab_ui/constants/theme.ts b/components/brave_new_tab_ui/constants/theme.ts deleted file mode 100644 index 38f8077c015e..000000000000 --- a/components/brave_new_tab_ui/constants/theme.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* 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/. */ - -export const theme = { - newTab: { - fontFamily: 'Poppins, sans-serif' - }, - newPrivateTab: { - fontFamily: 'Poppins, sans-serif', - padding: '80px 60px 40px', - background: 'linear-gradient(#4b3c6e, #000)' - }, - clock: { - color: '#fff', - fontSize: '90px' - }, - clockContainer: { - justifyContent: 'flex-end' - }, - textualContainer: { - maxWidth: '650px', - margin: '60px auto 0', - color: 'rgba(255,255,255,0.8)', - fontFamily: 'Muli, sans-serif' - }, - media: { - width: '80px', - margin: '0 0 0 25px' - }, - title: { - fontFamily: 'Poppins, sans-serif', - fontWeight: '400', - color: '#fff' - }, - italicText: { - fontStyle: 'italic', - fontSize: '15px' - }, - text: { - fontSize: '18px' - }, - switchContainer: { - margin: '40px 0 25px' - }, - switchButton: { - labelColor: 'rgba(255,255,255,0.8)' - } -} diff --git a/components/brave_new_tab_ui/reducers/new_tab_reducer.tsx b/components/brave_new_tab_ui/reducers/new_tab_reducer.tsx index 582e649cc680..8257b29fcd48 100644 --- a/components/brave_new_tab_ui/reducers/new_tab_reducer.tsx +++ b/components/brave_new_tab_ui/reducers/new_tab_reducer.tsx @@ -105,30 +105,6 @@ export const newTabReducer: Reducer = (state: NewTab.S state = { ...state, topSites: payload.topSites } calculateGridSites(state) break - case types.NEW_TAB_BACKGROUND_IMAGE_LOAD_FAILED: { - const source = '/50cc52a4f1743ea74a21da996fe44272.jpg' - const fallbackImage: NewTab.Image = { - name: 'Bay Bridge', - source, - style: { backgroundImage: 'url(' + source + ')' }, - author: 'Darrell Sano', - link: 'https://dksfoto.smugmug.com' - } - if (!state.imageLoadFailed) { - state = { - ...state, - backgroundImage: fallbackImage, - imageLoadFailed: true - } - } else { - state = { - ...state, - backgroundImage: undefined, - showImages: false - } - } - break - } case types.NEW_TAB_SITE_PINNED: { const topSiteIndex: number = state.topSites.findIndex((site) => site.url === payload.url) diff --git a/components/brave_new_tab_ui/storage.ts b/components/brave_new_tab_ui/storage.ts index 1c98d9ab2bad..247cd2c961a2 100644 --- a/components/brave_new_tab_ui/storage.ts +++ b/components/brave_new_tab_ui/storage.ts @@ -15,8 +15,6 @@ const defaultState: NewTab.State = { ignoredTopSites: [], pinnedTopSites: [], gridSites: [], - showImages: true, - imageLoadFailed: false, showEmptyPage: false, isIncognito: chrome.extension.inIncognitoContext, useAlternativePrivateSearchEngine: false, @@ -35,9 +33,6 @@ const defaultState: NewTab.State = { const randomBackgroundImage = (): NewTab.Image => { const randomIndex: number = Math.floor(Math.random() * backgrounds.length) const image: NewTab.Image = Object.assign({}, backgrounds[randomIndex]) - image.style = { - backgroundImage: 'url(' + image.source + ')' - } return image } @@ -55,7 +50,6 @@ export const getLoadTimeData = (state: NewTab.State) => { const cleanData = (state: NewTab.State): NewTab.State => { state = { ...state } state.backgroundImage = randomBackgroundImage() - delete state.imageLoadFailed state = getLoadTimeData(state) return state } diff --git a/components/definitions/newTab.d.ts b/components/definitions/newTab.d.ts index bac00c69d48c..73a233a9aa7b 100644 --- a/components/definitions/newTab.d.ts +++ b/components/definitions/newTab.d.ts @@ -4,13 +4,10 @@ declare namespace NewTab { } export interface Image { - name: string, - source: string, - author: string, - link: string, - style?: { - backgroundImage: string - } + name: string + source: string + author: string + link: string } export interface Site { @@ -44,12 +41,10 @@ declare namespace NewTab { } export interface State { - imageLoadFailed: boolean topSites: Site[], ignoredTopSites: Site[], pinnedTopSites: Site[], gridSites: Site[], - showImages: boolean, showEmptyPage: boolean, isIncognito: boolean, useAlternativePrivateSearchEngine: boolean, diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index 39de637dae3e..ad0d53810f1c 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -124,6 +124,7 @@ Estimated Time Saved Top site removed. Undo + Close Restore All second seconds diff --git a/components/styles/animations.less b/components/styles/animations.less deleted file mode 100644 index e68361237bfd..000000000000 --- a/components/styles/animations.less +++ /dev/null @@ -1,24 +0,0 @@ -/* 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/. */ - -@keyframes fadeIn { - from { - opacity: 0 - } - to { - opacity: 1 - } -} - -@keyframes tabFadeIn { - 0% { - opacity: 0.5 - } - 50% { - opacity: 0.6 - } - 100% { - opacity: 0.5 - } -} diff --git a/components/styles/button.less b/components/styles/button.less deleted file mode 100644 index 2a5c73dcde12..000000000000 --- a/components/styles/button.less +++ /dev/null @@ -1,130 +0,0 @@ -/* 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/. */ - -@import "variables.less"; - -// Remove this class from buttons as soon as -// they have been refactored. -// Only use it for default HTML