_CardSections.scss (13868B)
1 // Bug 1964453: Some styles here may appear duplicative — due to @includes and media queries, certain rules are intentionally overwritten rather than relying on cascade behavior. 2 3 @mixin section-card-small { 4 grid-row: span 1; 5 grid-column: span 1; 6 padding: var(--space-large); 7 8 &.refined-cards.ds-card.sections-card-ui { 9 box-shadow: var(--box-shadow-card); 10 11 &:hover { 12 box-shadow: var(--box-shadow-card-hover); 13 } 14 } 15 16 &.refined-cards { 17 .ds-card-link { 18 padding: var(--space-small); 19 flex-grow: 0; 20 } 21 22 .img-wrapper { 23 width: 110px; 24 height: 117px; 25 } 26 27 .meta { 28 padding: 0; 29 min-height: 117px; 30 31 .info-wrap { 32 flex-grow: 1 33 } 34 35 .sections-card-footer { 36 max-width: 114px; 37 min-height: unset; 38 position: initial; 39 margin-block-start: auto; 40 41 .source { 42 word-break: normal; 43 width: 114px; 44 } 45 } 46 } 47 48 .card-stp-button-hover-background { 49 background: transparent; 50 } 51 52 .card-stp-button-position-wrapper { 53 // context menu should match the padding for the parent 54 inset-inline-end: var(--space-small); 55 inset-block-end: var(--space-small); 56 } 57 58 .context-menu-position-container .context-menu-button { 59 height: 32px; 60 width: 32px; 61 } 62 } 63 64 &.ds-card.sections-card-ui { 65 padding: unset; 66 } 67 68 .ds-card-link { 69 display: flex; 70 flex-direction: row; 71 position: relative; 72 align-items: center; 73 gap: var(--space-medium); 74 padding: var(--space-large); 75 } 76 77 .img-wrapper { 78 width: 100px; 79 flex-shrink: 0; 80 flex-grow: 0; 81 aspect-ratio: 5/6; 82 83 .ds-image.img { 84 width: 100%; 85 height: 100%; 86 padding-block-start: 0; 87 min-width: 100%; 88 } 89 90 .ds-image.img img { 91 width: 100%; 92 height: 100%; 93 border-radius: var(--border-radius-medium) var(--border-radius-medium); 94 object-fit: cover; 95 } 96 } 97 98 &:not(.placeholder) { 99 .img-wrapper > .ds-image.img > img { 100 width: 100%; 101 border-radius: var(--border-radius-medium) var(--border-radius-medium); 102 } 103 } 104 105 .meta { 106 padding: 0; 107 align-self: flex-start; 108 min-height: 125px; 109 110 .info-wrap .title { 111 font-size: var(--font-size-small); 112 margin-block: 0; 113 -webkit-line-clamp: 4; 114 } 115 116 .sections-card-footer { 117 margin-block-start: var(--space-xxsmall); 118 } 119 } 120 121 .card-stp-button-hover-background { 122 padding-block-start: unset; 123 } 124 125 .card-stp-button-position-wrapper { 126 inset-inline-end: var(--space-small); 127 } 128 } 129 130 @mixin section-card-medium { 131 grid-row: span 2; 132 grid-column: span 1; 133 flex-direction: column; 134 padding: 0; 135 align-items: initial; 136 gap: initial; 137 138 &.refined-cards.ds-card.sections-card-ui { 139 height: unset; 140 box-shadow: var(--box-shadow-card); 141 142 &:hover { 143 box-shadow: var(--box-shadow-card-hover); 144 } 145 } 146 147 &.refined-cards { 148 .ds-card-link { 149 padding: unset; 150 flex-grow: 1; 151 } 152 153 .img-wrapper { 154 width: 100%; 155 height: 160px; 156 } 157 158 &.ds-spoc-rectangle { 159 .img-wrapper { 160 height: 250px; 161 } 162 } 163 164 .meta { 165 padding: var(--space-large) var(--space-large) var(--space-small); 166 min-height: unset; 167 168 .info-wrap { 169 flex-grow: initial; 170 } 171 172 .sections-card-footer { 173 max-width: 225px; 174 inset-inline-end: initial; 175 inset-block-end: initial; 176 min-height: 28px; 177 178 .source-wrapper { 179 max-width: 245px; 180 } 181 182 .source { 183 width: 217px; 184 } 185 } 186 187 &:has(.story-footer .story-sponsored-label) { 188 .sections-card-footer { 189 display: none; 190 } 191 192 .story-footer { 193 margin-block: auto 0; 194 195 } 196 } 197 } 198 199 .context-menu-position-container .context-menu-button { 200 height: 32px; 201 width: 32px; 202 } 203 204 .card-stp-button-position-wrapper { 205 // context menu should match the padding for the parent 206 inset-inline-end: var(--space-large); 207 inset-block-end: var(--space-small); 208 } 209 210 .card-stp-button-hover-background { 211 background: transparent; 212 } 213 214 &:hover, 215 &:active, 216 &:focus-within, 217 &.active { 218 .meta { 219 .source-wrapper { 220 max-width: 175px; 221 } 222 223 .source-wrapper .source { 224 display: block; 225 width: unset; 226 } 227 } 228 } 229 230 } 231 232 .card-stp-button-position-wrapper { 233 inset-inline-end: var(--space-small); 234 } 235 236 .card-stp-button-hover-background { 237 background: transparent; 238 } 239 240 .ds-card-link { 241 display: flex; 242 flex-direction: column; 243 gap: 0; 244 padding: 0; 245 } 246 247 .img-wrapper { 248 width: 100%; 249 position: relative; 250 // reset values inherited from small card mixin 251 flex-grow: 0; 252 flex-shrink: 0; 253 aspect-ratio: initial; 254 } 255 256 &:not(.placeholder) { 257 .img-wrapper > .ds-image.img > img { 258 border-radius: var(--border-radius-large) var(--border-radius-large) 0 0; 259 } 260 } 261 262 .meta { 263 padding: var(--space-medium) var(--space-large); 264 265 .info-wrap { 266 flex-grow: initial; 267 // flex-grow: 1;/ 268 269 .title { 270 -webkit-line-clamp: 3; 271 margin-block: 0 var(--space-small); 272 font-size: var(--font-size-root); 273 } 274 275 .excerpt { 276 display: block; 277 -webkit-line-clamp: 3; 278 } 279 } 280 281 .sections-card-footer { 282 margin-block-start: auto; 283 } 284 } 285 } 286 287 @mixin section-card-large { 288 grid-row: span 2; 289 grid-column: span 2; 290 291 &.refined-cards.ds-card.sections-card-ui { 292 box-shadow: var(--box-shadow-card); 293 294 @media ($break-point-layout-variant <=width < $break-point-widest), 295 (min-width: $break-point-sections-variant) { 296 .ds-card-link { 297 gap: var(--space-large); 298 padding: var(--space-large); 299 } 300 301 .meta { 302 padding: 0; 303 color: var(--newtab-text-primary-color); 304 305 .info-wrap .excerpt { 306 color: var(--text-color-deemphasized); 307 } 308 309 .sections-card-footer { 310 max-width: 334px; 311 312 .source-wrapper { 313 max-width: 245px; 314 } 315 } 316 } 317 318 .card-stp-button-position-wrapper { 319 inset-inline-end: var(--space-large); 320 inset-block-end: var(--space-large); 321 } 322 323 &:hover, 324 &:active, 325 &:focus-visible, 326 &.active { 327 .meta .source-wrapper .source { 328 display: block; 329 } 330 } 331 } 332 333 &:hover { 334 box-shadow: var(--box-shadow-card-hover); 335 } 336 } 337 338 &.ds-card.sections-card-ui { 339 @media ($break-point-layout-variant <=width < $break-point-widest), 340 (min-width: $break-point-sections-variant) { 341 align-content: flex-start; 342 justify-content: center; 343 344 .ds-card-link { 345 flex-direction: row; 346 gap: var(--space-xlarge); 347 padding: var(--space-xxlarge); 348 flex-grow: 0; 349 } 350 351 .img-wrapper { 352 width: 190px; 353 height: 250px; 354 } 355 356 .ds-image.img { 357 aspect-ratio: 1/1; 358 width: 100%; 359 height: 100%; 360 361 img { 362 border-radius: var(--border-radius-medium); 363 } 364 } 365 366 .meta { 367 padding: 0; 368 min-height: 220px; 369 370 .title { 371 -webkit-line-clamp: 3; 372 font-size: var(--font-size-large); 373 font-weight: var(--heading-font-weight); 374 margin-block: 0 var(--space-small); 375 } 376 377 .excerpt { 378 -webkit-line-clamp: 4; 379 font-size: var(--font-size-root); 380 } 381 382 .sections-card-footer { 383 margin-block-start: auto; 384 } 385 } 386 387 .card-stp-button-hover-background { 388 background: transparent; 389 inset-inline-start: 0; 390 } 391 } 392 } 393 } 394 395 .has-sections-grid .ds-outer-wrapper-breakpoint-override { 396 .ds-layout-topsites { 397 position: relative; 398 399 .top-sites-list-wrapper { 400 margin-inline: auto; 401 width: 100%; 402 } 403 404 .hide-for-narrow { 405 display: none; 406 407 @media (min-width: $break-point-large) { 408 display: none; 409 } 410 411 @media (min-width: $break-point-widest) { 412 display: inline-block; 413 } 414 } 415 } 416 } 417 418 .has-sections-grid { 419 .ds-outer-wrapper-breakpoint-override main { 420 width: auto; 421 422 .ds-card { 423 // card should take up availible space in grid 424 width: 100%; 425 height: 100%; 426 } 427 428 .body-wrapper { 429 width: 346px; 430 margin: 0 auto; 431 } 432 433 @media (min-width: $break-point-medium) { 434 width: auto; 435 436 .body-wrapper { 437 width: 346px; 438 } 439 } 440 441 @media (min-width: $break-point-layout-variant) { 442 width: auto; 443 444 .body-wrapper { 445 width: 659px; 446 } 447 } 448 449 @media (min-width: $break-point-widest) { 450 width: auto; 451 452 .body-wrapper { 453 width: 989px; 454 } 455 } 456 457 @media (min-width: $break-point-sections-variant) { 458 width: auto; 459 460 .body-wrapper { 461 display: flex; 462 flex-direction: column; 463 width: 1311px; 464 } 465 466 .ds-highlights .card-outer { 467 min-width: 216px; 468 } 469 } 470 } 471 } 472 473 .ds-section-wrapper { 474 padding-inline: 0; 475 position: relative; 476 477 .ds-section { 478 padding-block-end: var(--space-medium); 479 480 &:last-child { 481 padding-block-end: 0; 482 } 483 484 .section-heading { 485 display: flex; 486 justify-content: space-between; 487 align-items: center; 488 margin-block: var(--space-small) var(--space-medium); 489 490 .section-heading-inline-start { 491 display: flex; 492 flex-direction: row; 493 align-items: flex-start; 494 } 495 } 496 497 .section-title { 498 @include wallpaper-contrast-fix; 499 500 font-weight: var(--heading-font-weight); 501 font-size: var(--font-size-xlarge); 502 color: var(--newtab-contextual-text-primary-color); 503 margin-block: 0; 504 505 @media (min-width: $break-point-layout-variant) { 506 font-size: var(--font-size-xxlarge); 507 } 508 } 509 510 .section-subtitle { 511 @include wallpaper-contrast-fix; 512 513 color: var(--newtab-contextual-text-primary-color); 514 margin-block: var(--space-xsmall) 0; 515 font-size: var(--font-size-root); 516 } 517 } 518 519 .section-context-wrapper { 520 @include wallpaper-contrast-fix; 521 522 display: flex; 523 justify-content: space-between; 524 align-items: center; 525 column-gap: var(--space-small); 526 } 527 528 .section-follow { 529 position: relative; 530 531 .section-button-following-text { 532 display: none; 533 } 534 535 .section-button-unfollow-text { 536 display: none; 537 } 538 539 &.following { 540 .section-button-follow-text { 541 display: none; 542 } 543 544 .section-button-following-text { 545 display: block; 546 } 547 } 548 549 &.following:hover { 550 .section-button-following-text { 551 display: none; 552 } 553 554 .section-button-unfollow-text { 555 display: block; 556 } 557 } 558 } 559 } 560 561 .ds-section-grid.ds-card-grid { 562 grid-gap: var(--space-large); 563 grid-template-columns: repeat(1, 300px); 564 565 .ds-image { 566 &.image-2, 567 &.image-3, 568 &.image-4 { 569 display: none; 570 } 571 572 &.image-1 { 573 display: block; 574 } 575 } 576 577 @media (min-width: $break-point-medium) { 578 @for $i from 0 through 16 { 579 .col-1-position-#{$i} { 580 order: $i; 581 } 582 } 583 584 .col-1-small { 585 @include section-card-small; 586 } 587 588 .col-1-medium { 589 @include section-card-medium; 590 } 591 592 .col-1-large { 593 @include section-card-large; 594 } 595 596 .col-1-show-excerpt { 597 .meta .info-wrap .excerpt { 598 display: block; 599 } 600 } 601 602 .col-1-hide-excerpt { 603 .meta .info-wrap .excerpt { 604 display: none; 605 } 606 } 607 } 608 609 @media (min-width: $break-point-layout-variant) { 610 grid-template-columns: repeat(2, 300px); 611 612 @for $i from 0 through 16 { 613 .col-2-position-#{$i} { 614 order: $i; 615 } 616 } 617 618 .col-2-small { 619 @include section-card-small; 620 } 621 622 .col-2-medium { 623 @include section-card-medium; 624 } 625 626 .col-2-large { 627 @include section-card-large; 628 } 629 630 .col-2-show-excerpt { 631 .meta .info-wrap .excerpt { 632 display: block; 633 } 634 } 635 636 .col-2-hide-excerpt { 637 .meta .info-wrap .excerpt { 638 display: none; 639 } 640 } 641 642 .ds-image { 643 &.image-1, 644 &.image-3, 645 &.image-4 { 646 display: none; 647 } 648 649 &.image-2 { 650 display: block; 651 } 652 } 653 } 654 655 @media (min-width: $break-point-widest) { 656 grid-template-columns: repeat(3, 300px); 657 gap: var(--space-large); 658 659 @for $i from 0 through 16 { 660 .col-3-position-#{$i} { 661 order: $i; 662 } 663 } 664 665 .col-3-small { 666 @include section-card-small; 667 } 668 669 .col-3-medium { 670 @include section-card-medium; 671 } 672 673 .col-3-large { 674 @include section-card-large; 675 } 676 677 .col-3-show-excerpt { 678 .meta .info-wrap .excerpt { 679 display: block; 680 } 681 } 682 683 .col-3-hide-excerpt { 684 .meta .info-wrap .excerpt { 685 display: none; 686 } 687 } 688 689 .ds-image { 690 &.image-1, 691 &.image-2, 692 &.image-4 { 693 display: none; 694 } 695 696 &.image-3 { 697 display: block; 698 } 699 } 700 } 701 702 @media (min-width: $break-point-sections-variant) { 703 grid-template-columns: repeat(4, 300px); 704 705 @for $i from 0 through 16 { 706 .col-4-position-#{$i} { 707 order: $i; 708 } 709 } 710 711 .col-4-small { 712 @include section-card-small; 713 } 714 715 .col-4-medium { 716 @include section-card-medium; 717 } 718 719 .col-4-large { 720 @include section-card-large; 721 } 722 723 .col-4-show-excerpt { 724 .meta .info-wrap .excerpt { 725 display: block; 726 } 727 } 728 729 .col-4-hide-excerpt { 730 .meta .info-wrap .excerpt { 731 display: none; 732 } 733 } 734 735 .ds-image { 736 &.image-1, 737 &.image-2, 738 &.image-3 { 739 display: none; 740 } 741 742 &.image-4 { 743 display: block; 744 } 745 } 746 } 747 }