add initial news design

This commit is contained in:
2024-12-13 02:46:22 +01:00
parent 52e962ae83
commit f4596f41e4
12 changed files with 205 additions and 225 deletions

View File

@@ -1,144 +1,87 @@
.news-list-container {
margin: 2rem 0;
}
// .frame-type-news_newsliststicky {
// .header {
// display:flex;
// margin-bottom: 2.5rem;
//
// .title {
// flex: 1;
// align-content: center;
//
// h2 {
// margin: 0;
// }
// }
// }
// }
/* Mobile-first: single column by default */
/* All items in a single column */
.news-featured-wrapper,
.news-side-items,
.news-list-grid {
.news-list-view {
display: grid;
grid-template-columns: 1fr;
grid-template-columns: repeat(6, 1fr);
gap: 1rem;
}
grid-auto-rows: auto;
.news-item-featured,
.news-item-side,
.news-item-grid {
position: relative;
border-radius: 0.5rem;
overflow: hidden;
}
.news-item-featured-image,
.news-item-side-image,
.news-item-grid-image {
width: 100%;
height: auto;
display: block;
}
.news-item-featured-content,
.news-item-side-content,
.news-item-grid-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 1rem;
background: #215A2A;
color: #fff;
}
.news-item-category {
font-size: 0.9rem;
opacity: 0.9;
}
.news-item-title {
font-size: 1.2rem;
font-weight: bold;
margin-top: 0.5rem;
}
.news-item-link {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
}
.news-show-all {
margin-top: 2rem;
text-align: center;
}
.btn-show-all {
display: inline-block;
background: #6B8E23;
color: #fff;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
text-decoration: none;
font-weight: bold;
}
/* Adjust the title size for side and grid items */
.news-item-side-content .news-item-title,
.news-item-grid-content .news-item-title {
font-size: 1rem;
}
@media (min-width: 768px) and (max-width: 991px) {
/* On medium screens: switch to a 3-column grid for the first four items.
First four items are equal size and placed in a 3x grid. */
.news-featured-wrapper {
grid-template-columns: repeat(3, 1fr);
.news-list-item {
grid-column: span 6;
max-width: 100%;
}
/* For the first four items, we treat them all equally:
The first item (featured) plus next three (side items) fill a 3-column grid equally. */
.news-side-items {
display: contents; /* Merge side items into the same grid */
@media (max-width: $breakpoint-md) {
.news-list-item {
grid-column: span 2;
}
}
/* Additional items still in a 3-column grid */
.news-list-grid {
grid-template-columns: repeat(3, 1fr);
@media (min-width: $breakpoint-xl) {
.news-list-item {
grid-column: span 2;
&:first-of-type {
grid-column: 1 / span 4;
grid-row: span 2;
}
&:nth-of-type(2) {
grid-column: 5 / span 2;
grid-row: 1;
}
&:nth-of-type(3) {
grid-column: 5 / span 2;
grid-row: 2;
}
}
}
.f3-widget-paginator {
grid-column: span 6;
}
}
@media (min-width: 992px) {
/* On wide screens: special layout:
- First item bigger: takes 2 columns and 3 rows
- Next 3 items stacked in one column (3 rows) to the right of the big one
We'll create a 3-column grid for the first 4 items:
The first item (featured) will occupy the first two columns and span 3 rows.
The next 3 side items will each occupy the third column in their own row.
*/
.news-featured-wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: auto;
gap: 1rem;
.news-list-item {
.readmore {
font-weight: 700;
}
/* The featured item (index 0) spans 2 columns and 3 rows */
.news-featured-item {
grid-column: 1 / span 2;
grid-row: 1 / span 3;
img {
width: 100%;
height: auto;
}
/* Side items should appear in the third column, one per row */
.news-side-items {
display: contents;
}
a {
display: flex;
flex-direction: column;
.news-side-items .news-item-side:nth-of-type(1) {
grid-column: 3;
grid-row: 1;
}
.news-side-items .news-item-side:nth-of-type(2) {
grid-column: 3;
grid-row: 2;
}
.news-side-items .news-item-side:nth-of-type(3) {
grid-column: 3;
grid-row: 3;
}
.body {
position: relative;
padding: .5rem;
}
/* Additional items still in a 3-column grid below the first four */
.news-list-grid {
grid-template-columns: repeat(3, 1fr);
time {
padding-left: .6rem;
color: var(--bs-gray-900);
}
.readmore {
color: var(--bs-primary);
}
}
}