File tree Expand file tree Collapse file tree 3 files changed +72
-2
lines changed
components/brave_new_tab_ui Expand file tree Collapse file tree 3 files changed +72
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ const StyledPage = styled('div')<PageProps>`
71
71
width: 100%;
72
72
display: grid;
73
73
grid-template-rows: repeat(calc(var(--ntp-page-rows) - 1), min-content) auto;
74
- grid-template-columns: min-content auto min-content;
74
+ grid-template-columns: min-content 1fr min-content;
75
75
grid-auto-flow: row dense;
76
76
padding: var(--ntp-page-padding);
77
77
overflow: hidden;
@@ -185,10 +185,29 @@ export const GridItemWidgetStack = styled('section')`
185
185
`
186
186
187
187
export const GridItemTopSites = styled ( 'section' ) `
188
- grid-column: 1 / span 2 ;
188
+ grid-column: 1;
189
189
${ singleColumnSmallViewport }
190
190
`
191
191
192
+ export const GridItemSponsoredImageClickArea = styled . section < { otherWidgetsHidden : boolean } > `
193
+ grid-column: 2;
194
+ grid-row: 2 / span 3;
195
+ height: calc(100% - 200px);
196
+ width: 100%;
197
+ position: relative;
198
+
199
+ @media screen and (max-width: ${ breakpointEveryBlock } ) {
200
+ ${ ( p ) =>
201
+ p . otherWidgetsHidden
202
+ ? css `
203
+ flex-grow : 2 ;
204
+ `
205
+ : css `
206
+ display : none
207
+ ` }
208
+ }
209
+ `
210
+
192
211
export const GridItemNotification = styled ( 'section' ) `
193
212
position: fixed;
194
213
left: 50%;
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2023 The Brave Authors. All rights reserved.
2
+ // This Source Code Form is subject to the terms of the Mozilla Public
3
+ // License, v. 2.0. If a copy of the MPL was not distributed with this file,
4
+ // You can obtain one at https://mozilla.org/MPL/2.0/.
5
+
6
+ import { OpenNewIcon } from 'brave-ui/components/icons'
7
+ import * as React from 'react'
8
+ import styled from 'styled-components'
9
+
10
+ const Indicator = styled . span `
11
+ display: none;
12
+
13
+ position: absolute;
14
+ top: 8px;
15
+ right: 8px;
16
+
17
+ width: 20px;
18
+ height: 20px;
19
+ color: white;
20
+ `
21
+
22
+ const Link = styled . a `
23
+ position: absolute;
24
+ top: 8px;
25
+ left: 8px;
26
+ right: 56px;
27
+ bottom: 8px;
28
+ display: block;
29
+
30
+ &:hover {
31
+ cursor: pointer;
32
+ ${ Indicator } {
33
+ display: block;
34
+ }
35
+ }
36
+ `
37
+
38
+ export default function SponsoredImageClickArea ( props : { sponsoredImageUrl : string , onClick : ( ) => void } ) {
39
+ return (
40
+ < Link href = { props . sponsoredImageUrl } rel = "noreferrer noopener" onClick = { props . onClick } >
41
+ < Indicator >
42
+ < OpenNewIcon />
43
+ </ Indicator >
44
+ </ Link >
45
+ )
46
+ }
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import Settings, { TabType as SettingsTabType } from './settings'
37
37
import { BraveNewsContextProvider } from '../../components/default/braveNews/customize/Context'
38
38
import BraveNewsHint from '../../components/default/braveNews/hint'
39
39
import GridWidget from './gridWidget'
40
+ import SponsoredImageClickArea from '../../components/default/sponsoredImage/sponsoredImageClickArea'
40
41
41
42
interface Props {
42
43
newTabData : NewTab . State
@@ -640,6 +641,10 @@ class NewTabPage extends React.Component<Props, State> {
640
641
/>
641
642
</ Page . GridItemTopSites >
642
643
}
644
+ { newTabData . brandedWallpaper ?. isSponsored && < Page . GridItemSponsoredImageClickArea otherWidgetsHidden = { this . allWidgetsHidden ( ) } >
645
+ < SponsoredImageClickArea onClick = { this . onClickLogo }
646
+ sponsoredImageUrl = { newTabData . brandedWallpaper . logo . destinationUrl } />
647
+ </ Page . GridItemSponsoredImageClickArea > }
643
648
{
644
649
gridSitesData . shouldShowSiteRemovedNotification
645
650
? (
You can’t perform that action at this time.
0 commit comments