334 lines
6.9 KiB
SCSS
334 lines
6.9 KiB
SCSS
@use 'sass:math';
|
|
|
|
/* stylelint-disable max-nesting-depth */
|
|
|
|
.card-outer {
|
|
@include context-menu-button;
|
|
|
|
background: var(--newtab-background-color-secondary);
|
|
border-radius: var(--border-radius-medium);
|
|
display: inline-block;
|
|
height: $card-height;
|
|
margin-inline-end: $base-gutter;
|
|
position: relative;
|
|
width: 100%;
|
|
|
|
&:is(:focus):not(.placeholder) {
|
|
@include ds-focus;
|
|
|
|
transition: none;
|
|
}
|
|
|
|
&:hover {
|
|
box-shadow: none;
|
|
transition: none;
|
|
}
|
|
|
|
&.placeholder {
|
|
background: transparent;
|
|
|
|
.card-preview-image-outer,
|
|
.card-context {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
.card {
|
|
border-radius: var(--border-radius-medium);
|
|
box-shadow: $shadow-card;
|
|
height: 100%;
|
|
}
|
|
|
|
> a {
|
|
color: inherit;
|
|
display: block;
|
|
height: 100%;
|
|
outline: none;
|
|
position: absolute;
|
|
width: 100%;
|
|
|
|
&:is(:focus) {
|
|
.card {
|
|
@include ds-focus;
|
|
}
|
|
}
|
|
|
|
&:is(.active, :focus) {
|
|
.card {
|
|
@include fade-in-card;
|
|
}
|
|
|
|
.card-title {
|
|
color: var(--newtab-primary-action-background);
|
|
}
|
|
}
|
|
}
|
|
|
|
&:is(:hover, :focus, .active):not(.placeholder) {
|
|
@include context-menu-button-hover;
|
|
|
|
outline: none;
|
|
|
|
.card-title {
|
|
color: var(--newtab-primary-action-background);
|
|
}
|
|
|
|
.alternate ~ .card-host-name {
|
|
display: none;
|
|
}
|
|
|
|
.card-host-name.alternate {
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
.card-preview-image-outer {
|
|
background-color: var(--newtab-element-secondary-color);
|
|
border-radius: var(--border-radius-medium) var(--border-radius-medium) 0 0;
|
|
height: $card-preview-image-height;
|
|
overflow: hidden;
|
|
position: relative;
|
|
|
|
&::after {
|
|
border-bottom: 1px solid var(--newtab-card-hairline-color);
|
|
bottom: 0;
|
|
content: '';
|
|
position: absolute;
|
|
width: 100%;
|
|
}
|
|
|
|
.card-preview-image {
|
|
background-position: center;
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
height: 100%;
|
|
opacity: 0;
|
|
transition: opacity 1s $photon-easing;
|
|
width: 100%;
|
|
|
|
&.loaded {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
.card-details {
|
|
padding: 15px 16px 12px;
|
|
}
|
|
|
|
.card-text {
|
|
max-height: 4 * $card-text-line-height + $card-title-margin;
|
|
overflow: hidden;
|
|
|
|
&.no-host-name,
|
|
&.no-context {
|
|
max-height: 5 * $card-text-line-height + $card-title-margin;
|
|
}
|
|
|
|
&.no-host-name.no-context {
|
|
max-height: 6 * $card-text-line-height + $card-title-margin;
|
|
}
|
|
|
|
&:not(.no-description) .card-title {
|
|
max-height: 3 * $card-text-line-height;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
.card-host-name {
|
|
color: var(--newtab-text-secondary-color);
|
|
font-size: var(--font-size-small);
|
|
overflow: hidden;
|
|
padding-bottom: 4px;
|
|
text-overflow: ellipsis;
|
|
text-transform: uppercase;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.card-host-name.alternate { display: none; }
|
|
|
|
.card-title {
|
|
font-size: inherit;
|
|
font-weight: var(--font-weight-bold);
|
|
line-height: $card-text-line-height;
|
|
margin: 0 0 $card-title-margin;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.card-description {
|
|
font-size: var(--font-size-small);
|
|
line-height: $card-text-line-height;
|
|
margin: 0;
|
|
overflow: hidden;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.card-context {
|
|
bottom: 0;
|
|
color: var(--newtab-text-secondary-color);
|
|
display: flex;
|
|
font-size: var(--font-size-small);
|
|
inset-inline-start: 0;
|
|
padding: 9px 16px 9px 14px;
|
|
position: absolute;
|
|
}
|
|
|
|
.card-context-icon {
|
|
fill: var(--newtab-text-secondary-color);
|
|
height: 22px;
|
|
margin-inline-end: 6px;
|
|
}
|
|
|
|
.card-context-label {
|
|
flex-grow: 1;
|
|
line-height: 22px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
|
|
.normal-cards {
|
|
.card-outer {
|
|
// Wide layout styles
|
|
@media (min-width: $break-point-widest) {
|
|
$line-height: 23px;
|
|
|
|
height: $card-height-large;
|
|
|
|
.card-preview-image-outer {
|
|
height: $card-preview-image-height-large;
|
|
}
|
|
|
|
.card-details {
|
|
padding: 13px 16px 12px;
|
|
}
|
|
|
|
.card-text {
|
|
max-height: 6 * $line-height + $card-title-margin;
|
|
}
|
|
|
|
.card-host-name {
|
|
font-size: var(--font-size-small);
|
|
padding-bottom: 5px;
|
|
}
|
|
|
|
.card-title {
|
|
font-size: var(--font-size-large);
|
|
line-height: $line-height;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.card-text:not(.no-description) {
|
|
.card-title {
|
|
max-height: 3 * $line-height;
|
|
}
|
|
}
|
|
|
|
.card-description {
|
|
font-size: inherit;
|
|
line-height: $line-height;
|
|
}
|
|
|
|
.card-context {
|
|
bottom: 4px;
|
|
font-size: inherit;
|
|
line-height: $line-height;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.compact-cards {
|
|
$card-detail-vertical-spacing: 12px;
|
|
$card-title-font-size: var(--font-size-small);
|
|
|
|
.card-outer {
|
|
height: $card-height-compact;
|
|
|
|
.card-preview-image-outer {
|
|
height: $card-preview-image-height-compact;
|
|
}
|
|
|
|
.card-details {
|
|
padding: $card-detail-vertical-spacing 16px;
|
|
}
|
|
|
|
.card-host-name {
|
|
line-height: 10px;
|
|
}
|
|
|
|
.card-text {
|
|
.card-title,
|
|
&:not(.no-description) .card-title {
|
|
font-size: $card-title-font-size;
|
|
line-height: $card-title-font-size + 1;
|
|
max-height: $card-title-font-size + 5;
|
|
overflow: hidden;
|
|
padding: 0 0 4px;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
|
|
.card-description {
|
|
display: none;
|
|
}
|
|
|
|
.card-context {
|
|
$icon-size: 16px;
|
|
$container-size: 32px;
|
|
|
|
background-color: var(--newtab-background-color-secondary);
|
|
border-radius: var(--border-radius-medium);
|
|
clip-path: inset(-1px -1px $container-size - ($card-height-compact - $card-preview-image-height-compact - 2 * $card-detail-vertical-spacing));
|
|
height: $container-size;
|
|
width: $container-size;
|
|
padding: math.div($container-size - $icon-size, 2);
|
|
// The -1 at the end is so both opacity borders don't overlap, which causes bug 1629483
|
|
top: $card-preview-image-height-compact - math.div($container-size, 2) - 1;
|
|
inset-inline-end: 12px;
|
|
inset-inline-start: auto;
|
|
|
|
&::after {
|
|
border: 1px solid var(--newtab-card-hairline-color);
|
|
border-bottom: 0;
|
|
border-radius: var(--border-radius-medium);
|
|
content: '';
|
|
position: absolute;
|
|
height: math.div($container-size + 2, 2);
|
|
width: $container-size + 2;
|
|
top: -1px;
|
|
left: -1px;
|
|
}
|
|
|
|
.card-context-icon {
|
|
margin-inline-end: 0;
|
|
height: $icon-size;
|
|
width: $icon-size;
|
|
|
|
&.icon-bookmark-added {
|
|
fill: $bookmark-icon-fill;
|
|
}
|
|
|
|
&.icon-download {
|
|
fill: $download-icon-fill;
|
|
}
|
|
|
|
&.icon-pocket {
|
|
fill: $pocket-icon-fill;
|
|
}
|
|
}
|
|
|
|
.card-context-label {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
@media not all and (min-width: $break-point-widest) {
|
|
.hide-for-narrow {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|