style: add Related Stories layouts
This commit is contained in:
4 files changed
+388
-3
No files matched your search
@@ -1,3 +1,155 @@
|
||||
.chrnx-related-posts {
|
||||
--chrnx-related-gap: var(--wp--preset--spacing--40, 1.5rem);
|
||||
--chrnx-related-control-background: var(--wp--preset--color--panel);
|
||||
--chrnx-related-control-border: var(--wp--preset--color--muted);
|
||||
--chrnx-related-control-text: var(--wp--preset--color--text);
|
||||
--chrnx-related-focus-ring: var(--wp--preset--color--green);
|
||||
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .chrnx-related-posts {
|
||||
--chrnx-related-focus-ring: var(--wp--preset--color--green);
|
||||
}
|
||||
|
||||
html[data-theme="light"] .chrnx-related-posts {
|
||||
--chrnx-related-control-background: var(--wp--preset--color--surface);
|
||||
--chrnx-related-control-border: var(--wp--preset--color--border);
|
||||
--chrnx-related-control-text: var(--wp--preset--color--ink);
|
||||
--chrnx-related-focus-ring: var(--wp--preset--color--light-green);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
|
||||
:root:not([data-theme]) .chrnx-related-posts {
|
||||
--chrnx-related-control-background: var(--wp--preset--color--surface);
|
||||
--chrnx-related-control-border: var(--wp--preset--color--border);
|
||||
--chrnx-related-control-text: var(--wp--preset--color--ink);
|
||||
--chrnx-related-focus-ring: var(--wp--preset--color--light-green);
|
||||
}
|
||||
}
|
||||
|
||||
.chrnx-related-posts__items {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
align-items: stretch;
|
||||
gap: var(--chrnx-related-gap);
|
||||
}
|
||||
|
||||
.chrnx-related-card,
|
||||
.chrnx-related-card__link,
|
||||
.chrnx-related-card__content {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.chrnx-related-posts.is-layout-grid .chrnx-related-posts__items {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.chrnx-related-posts.is-layout-carousel .chrnx-related-posts__items {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
overscroll-behavior-inline: contain;
|
||||
scroll-snap-type: x mandatory;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.chrnx-related-posts.is-layout-carousel .chrnx-related-card {
|
||||
flex: 0 0 calc((100% - var(--chrnx-related-gap) - var(--chrnx-related-gap)) / 3);
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
|
||||
.chrnx-related-card__link {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chrnx-related-card__content {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.chrnx-related-posts__controls {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: var(--wp--preset--spacing--20, 0.75rem);
|
||||
margin-top: var(--wp--preset--spacing--30, 1rem);
|
||||
}
|
||||
|
||||
.chrnx-related-posts__controls[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.chrnx-related-posts__controls button {
|
||||
display: inline-flex;
|
||||
min-width: 45px;
|
||||
min-height: 45px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.5rem 0.875rem;
|
||||
border: 1px solid var(--chrnx-related-control-border);
|
||||
border-radius: 999px;
|
||||
background: var(--chrnx-related-control-background);
|
||||
color: var(--chrnx-related-control-text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chrnx-related-posts__controls button:disabled {
|
||||
opacity: 0.55;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.chrnx-related-posts__controls button:focus-visible {
|
||||
outline: 2px solid transparent;
|
||||
outline-offset: 3px;
|
||||
box-shadow: 0 0 0 3px var(--chrnx-related-focus-ring);
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
|
||||
.chrnx-related-posts.is-layout-adaptive .chrnx-related-posts__items {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
overscroll-behavior-inline: contain;
|
||||
scroll-snap-type: x mandatory;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.chrnx-related-posts.is-layout-adaptive .chrnx-related-card,
|
||||
.chrnx-related-posts.is-layout-carousel .chrnx-related-card {
|
||||
flex: 0 0 calc(100% - clamp(3rem, 12vw, 7rem));
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 901px) {
|
||||
|
||||
.chrnx-related-posts.is-layout-adaptive .chrnx-related-posts__items,
|
||||
.chrnx-related-posts.is-layout-grid .chrnx-related-posts__items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.chrnx-related-posts:is(.is-layout-adaptive, .is-layout-grid) .chrnx-related-posts__items:not(:has(> .chrnx-related-card:nth-child(2))) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.chrnx-related-posts:is(.is-layout-adaptive, .is-layout-grid) .chrnx-related-posts__items:has(> .chrnx-related-card:nth-child(2)):not(:has(> .chrnx-related-card:nth-child(3))) {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
|
||||
.chrnx-related-posts.is-layout-adaptive .chrnx-related-posts__items,
|
||||
.chrnx-related-posts.is-layout-carousel .chrnx-related-posts__items {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.chrnx-related-card__image,
|
||||
.chrnx-related-card__fallback {
|
||||
aspect-ratio: 3 / 2;
|
||||
|
||||
Reference in new issue
Block a user