mediawiki-extensions-Relate.../resources/ext.relatedArticles.readMore/styles.less

161 lines
3.4 KiB
Plaintext
Raw Normal View History

@import 'mediawiki.skin.variables.less';
@import 'mediawiki.mixins';
@baseFontSize: 1em;
@thumbWidth: 80px;
@cardBorder: 1px solid rgba( 0, 0, 0, 0.2 );
.ext-related-articles-card-list {
.flex-display();
flex-flow: row wrap;
font-size: @baseFontSize;
list-style: none;
overflow: hidden;
position: relative;
padding-left: 0;
h3 {
@fontSize: 1em;
@lineHeight: 1.3;
@lineHeightEm: @lineHeight * @fontSize;
font-family: inherit;
font-size: @fontSize;
// max 2 lines
max-height: 2 * @lineHeightEm;
line-height: @lineHeight;
margin: 0;
overflow: hidden;
padding: 0;
position: relative;
font-weight: 500;
a {
color: @color-emphasized;
}
&::after {
content: ' ';
position: absolute;
right: 0;
bottom: 0;
width: 25%;
height: @lineHeightEm;
background-color: transparent;
background-image: linear-gradient( to right, rgba( 255, 255, 255, 0 ), rgba( 255, 255, 255, 1 ) 50% );
}
}
// flex-item
.ext-related-articles-card {
background-color: @background-color-base;
box-sizing: border-box;
margin: 0;
height: @thumbWidth;
position: relative;
width: 100%;
border: @cardBorder;
& + .ext-related-articles-card {
border-top: 0;
}
// Apply radius to top & bottom cards when stacked
&:first-child {
border-radius: @border-radius-base @border-radius-base 0 0;
}
&:last-child {
border-radius: 0 0 @border-radius-base @border-radius-base;
}
}
.ext-related-articles-card > a {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
&:hover {
box-shadow: 0 1px 1px rgba( 0, 0, 0, 0.1 );
}
}
.ext-related-articles-card-detail {
// Vertically center the element using the technique described at
// http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/.
//
// This technique is ideal because:
// * it's easy to reason about,
// * `position: relative` means that the element is laid out as if it weren't
// positioned, allowing for `text-overflow: ellipsis` to work (see below)
// * it supports more browsers than flexbox does, and
// * we don't deliver RelatedArticles assets to those browsers that don't
// support CSS 2D transforms
position: relative;
top: 50%;
transform: translateY( -50% );
}
.ext-related-articles-card-extract {
color: @color-subtle;
font-size: 0.8em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 2px;
}
.ext-related-articles-card-thumb {
background-color: #eaecf0;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
float: left;
height: 100%;
width: @thumbWidth;
margin-right: 10px;
}
.ext-related-articles-card-thumb-placeholder {
background-image: url( article.svg );
background-size: 40px 40px;
}
}
@media all and ( min-width: @min-width-breakpoint-tablet ) {
.ext-related-articles-card-list {
border-top: 0;
.ext-related-articles-card {
border: @cardBorder;
@rightMargin: 1%;
margin-right: @rightMargin;
margin-bottom: 10px;
// max space is 100-2/3
width: ( 100 - ( 2 * @rightMargin ) ) / 3;
// Individual border-radius when cards side by side (not stacked)
&,
&:first-child,
&:last-child {
border-radius: @border-radius-base;
}
&:last-child {
margin-right: 0;
}
& + .ext-related-articles-card {
border: @cardBorder;
}
// every 3rd child drop the right margin
&:nth-child( 3n+3 ) {
margin-right: 0;
}
}
}
}