Skip to content

Commit 9dc9e4b

Browse files
committed
Bug 1965944 - Revert "Bug 1965944 - Visual updates for medium card UI. "
This reverts commit c94714433dc639941f392ec3ceb656a3ce0b81b2. Differential Revision: https://phabricator.services.mozilla.com/D250596 UltraBlame original commit: 2740d3e3f1f0c14adeb61399803016c54e4bae25
1 parent b935e31 commit 9dc9e4b

File tree

9 files changed

+29
-240
lines changed

9 files changed

+29
-240
lines changed

browser/extensions/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/CardGrid.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const PREF_BILLBOARD_ENABLED = "newtabAdSize.billboard";
3131
const PREF_LEADERBOARD_ENABLED = "newtabAdSize.leaderboard";
3232
const PREF_LEADERBOARD_POSITION = "newtabAdSize.leaderboard.position";
3333
const PREF_BILLBOARD_POSITION = "newtabAdSize.billboard.position";
34-
const PREF_REFINED_CARDS_ENABLED = "discoverystream.refinedCardsLayout.enabled";
3534
const INTERSECTION_RATIO = 0.5;
3635
const VISIBLE = "visible";
3736
const VISIBILITY_CHANGE_EVENT = "visibilitychange";
@@ -362,8 +361,6 @@ export class _CardGrid extends React.PureComponent {
362361
const listFeedSelectedFeed = prefs[PREF_LIST_FEED_SELECTED_FEED];
363362
const billboardEnabled = prefs[PREF_BILLBOARD_ENABLED];
364363
const leaderboardEnabled = prefs[PREF_LEADERBOARD_ENABLED];
365-
const refinedCardsLayout = prefs[PREF_REFINED_CARDS_ENABLED];
366-
367364
// filter out recs that should be in ListFeed
368365
const recs = this.props.data.recommendations
369366
.filter(item => !item.feedName)
@@ -398,8 +395,8 @@ export class _CardGrid extends React.PureComponent {
398395
features={rec.features}
399396
showTopics={showTopics}
400397
selectedTopics={selectedTopics}
401-
excerpt={refinedCardsLayout && rec.excerpt}
402398
availableTopics={availableTopics}
399+
excerpt={rec.excerpt}
403400
url={rec.url}
404401
id={rec.id}
405402
shim={rec.shim}

browser/extensions/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@
77
border-radius: var(--border-radius-medium);
88
box-shadow: $shadow-card;
99

10-
img,
11-
.placeholder-image {
12-
border-radius: var(--border-radius-medium) var(--border-radius-medium) 0 0;
10+
.img-wrapper .img {
11+
img,
12+
.placeholder-image {
13+
border-radius: var(--border-radius-medium) var(--border-radius-medium) 0 0;
14+
}
1315
}
1416
}
1517
}
1618

17-
.ds-card.refined-cards:not(.placeholder) {
18-
.img-wrapper .img {
19-
height: 172px;
20-
width: 100%;
21-
}
22-
}
23-
2419
.ds-onboarding-container {
2520
padding-inline-start: 16px;
2621
padding-inline-end: 16px;
@@ -126,17 +121,14 @@
126121
display: grid;
127122
grid-gap: 24px;
128123
position: relative;
124+
// Bug 1926056: Row/column Gap spacing to allow for IAB fixed ad sizes
125+
row-gap: 24px;
126+
column-gap: 18px;
129127

130128
&.ds-card-grid-compact {
131129
grid-gap: 20px;
132130
}
133131

134-
&.ad-sizing-variant-a,
135-
&.ad-sizing-variant-b {
136-
row-gap: 24px;
137-
column-gap: 18px;
138-
}
139-
140132
&.ds-card-grid-recent-saves {
141133
.ds-card {
142134
// Hide the second row orphan on narrow screens.

browser/extensions/newtab/content-src/components/DiscoveryStreamComponents/CardSections/CardSections.jsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ const PREF_BILLBOARD_ENABLED = "newtabAdSize.billboard";
3232
const PREF_LEADERBOARD_ENABLED = "newtabAdSize.leaderboard";
3333
const PREF_LEADERBOARD_POSITION = "newtabAdSize.leaderboard.position";
3434
const PREF_BILLBOARD_POSITION = "newtabAdSize.billboard.position";
35-
const PREF_REFINED_CARDS_ENABLED = "discoverystream.refinedCardsLayout.enabled";
3635

37-
function getLayoutData(responsiveLayouts, index, refinedCardsLayout) {
36+
function getLayoutData(responsiveLayouts, index) {
3837
let layoutData = {
3938
classNames: [],
4039
imageSizes: {},
@@ -52,15 +51,7 @@ function getLayoutData(responsiveLayouts, index, refinedCardsLayout) {
5251
// The API tells us whether the tile should show the excerpt or not.
5352
// Apply extra styles accordingly.
5453
if (tile.hasExcerpt) {
55-
if (tile.size === "medium" && refinedCardsLayout) {
56-
layoutData.classNames.push(
57-
`col-${layout.columnCount}-hide-excerpt`
58-
);
59-
} else {
60-
layoutData.classNames.push(
61-
`col-${layout.columnCount}-show-excerpt`
62-
);
63-
}
54+
layoutData.classNames.push(`col-${layout.columnCount}-show-excerpt`);
6455
} else {
6556
layoutData.classNames.push(`col-${layout.columnCount}-hide-excerpt`);
6657
}
@@ -123,7 +114,6 @@ function CardSection({
123114
const mayHaveThumbsUpDown = prefs[PREF_THUMBS_UP_DOWN_ENABLED];
124115
const selectedTopics = prefs[PREF_TOPICS_SELECTED];
125116
const availableTopics = prefs[PREF_TOPICS_AVAILABLE];
126-
const refinedCardsLayout = prefs[PREF_REFINED_CARDS_ENABLED];
127117

128118
const { saveToPocketCard } = useSelector(state => state.DiscoveryStream);
129119
const mayHaveSectionsPersonalization =
@@ -270,8 +260,7 @@ function CardSection({
270260
{section.data.slice(0, maxTile).map((rec, index) => {
271261
const { classNames, imageSizes } = getLayoutData(
272262
responsiveLayouts,
273-
index,
274-
refinedCardsLayout
263+
index
275264
);
276265

277266
if (!rec || rec.placeholder) {

browser/extensions/newtab/content-src/components/DiscoveryStreamComponents/CardSections/_CardSections.scss

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@
55
grid-column: span 1;
66
padding: var(--space-large);
77

8-
&.refined-cards.ds-card.sections-card-ui {
9-
height: fit-content;
10-
}
11-
12-
&.refined-cards {
13-
.ds-card-link {
14-
padding: var(--space-xsmall) var(--space-small);
15-
flex-grow: 0;
16-
}
17-
18-
.img-wrapper {
19-
width: 110px;
20-
height: 117px;
21-
}
22-
}
238

249
&.ds-card.sections-card-ui {
2510
padding: unset;
@@ -36,6 +21,7 @@
3621
align-items: center;
3722
gap: var(--space-medium);
3823
padding: var(--space-large);
24+
3925
}
4026

4127
.img-wrapper {
@@ -91,6 +77,7 @@
9177
}
9278
}
9379

80+
9481
@mixin section-card-medium {
9582
grid-row: span 2;
9683
grid-column: span 1;
@@ -99,23 +86,6 @@
9986
align-items: initial;
10087
gap: initial;
10188

102-
&.refined-cards.ds-card.sections-card-ui {
103-
height: unset;
104-
}
105-
106-
// .refined-medium-card only appears if refinedCardsLayout.enabled pref is set to true
107-
&.refined-cards {
108-
.ds-card-link {
109-
padding: unset;
110-
flex-grow: unset;
111-
}
112-
113-
.img-wrapper {
114-
width: 100%;
115-
height: 172px;
116-
}
117-
}
118-
11989
.card-stp-button-position-wrapper {
12090
inset-inline-end: 10px;
12191
}
@@ -150,8 +120,6 @@
150120
padding: var(--space-medium) var(--space-large);
151121

152122
.info-wrap {
153-
flex-grow: initial;
154-
155123
.title {
156124
-webkit-line-clamp: 3;
157125
margin-block: 0 var(--space-small);
@@ -163,10 +131,6 @@
163131
-webkit-line-clamp: 3;
164132
}
165133
}
166-
167-
.sections-card-footer {
168-
margin-top: auto;
169-
}
170134
}
171135
}
172136

@@ -189,14 +153,11 @@
189153

190154
.img-wrapper {
191155
width: 265px;
192-
height: 100%;
193156
}
194157

195158
.ds-image.img {
196159
// Square ratio
197160
aspect-ratio: 1/1;
198-
width: 100%;
199-
height: 100%;
200161

201162
img {
202163
border-radius: var(--border-radius-medium);

browser/extensions/newtab/content-src/components/DiscoveryStreamComponents/DSCard/DSCard.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ export class _DSCard extends React.PureComponent {
208208
this.onMenuShow = this.onMenuShow.bind(this);
209209
this.onThumbsUpClick = this.onThumbsUpClick.bind(this);
210210
this.onThumbsDownClick = this.onThumbsDownClick.bind(this);
211-
const refinedCardsLayout =
212-
this.props.Prefs.values["discoverystream.refinedCardsLayout.enabled"];
213211

214212
this.setContextMenuButtonHostRef = element => {
215213
this.contextMenuButtonHostElement = element;
@@ -286,7 +284,7 @@ export class _DSCard extends React.PureComponent {
286284
},
287285
medium: {
288286
width: 300,
289-
height: refinedCardsLayout ? 172 : 150,
287+
height: 150,
290288
},
291289
large: {
292290
width: 265,

browser/extensions/newtab/content-src/components/DiscoveryStreamComponents/DSCard/_DSCard.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,12 @@ $ds-card-image-gradient-solid: rgba(0, 0, 0, 100%);
8787
position: relative;
8888
}
8989

90-
&.refined-cards {
91-
.card-stp-button-hover-background {
92-
height: 172px;
93-
}
94-
}
95-
9690
.card-stp-button-hover-background {
9791
opacity: 0;
9892
width: 100%;
9993
position: absolute;
10094
top: 0;
95+
height: 0;
10196
transition: opacity;
10297
transition-duration: 0s;
10398
padding-block-start: 50%;

0 commit comments

Comments
 (0)