- typed client and useFaq/useFaqApi (SSR, faq:<slug>:<locale> key, server and public bases, x-forwarded-for forwarded also on cached renders) - FaqBlock, FaqList and FaqItem: native details, exclusive and openFirst, server-sanitized description and answers, nothing or #fallback on 404, error or no items - FAQ tokens and base CSS with the .faq-html rules, README - node client tests and a playground SSR smoke against a fixture API
134 lines
2.6 KiB
CSS
134 lines
2.6 KiB
CSS
/* FaqBlock styles. Global, unscoped and token-driven, so an app restyles the
|
|
FAQ through the tokens or its own rules. */
|
|
|
|
.faq-block {
|
|
font-family: var(--faq-font);
|
|
font-size: var(--faq-font-size-base);
|
|
line-height: var(--faq-line-height);
|
|
color: var(--faq-color-text);
|
|
}
|
|
|
|
.faq-block__title {
|
|
margin: 0 0 var(--faq-space-2);
|
|
font-size: var(--faq-title-size);
|
|
font-weight: 600;
|
|
line-height: 1.25;
|
|
}
|
|
|
|
.faq-block__description {
|
|
margin-bottom: var(--faq-space-4);
|
|
}
|
|
|
|
.faq-list {
|
|
display: grid;
|
|
gap: var(--faq-space-3);
|
|
}
|
|
|
|
.faq-item {
|
|
border: 1px solid var(--faq-color-border);
|
|
border-radius: var(--faq-radius);
|
|
background: var(--faq-color-bg);
|
|
}
|
|
|
|
.faq-item[open] {
|
|
box-shadow: var(--faq-shadow);
|
|
}
|
|
|
|
.faq-item__question {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: var(--faq-space-3);
|
|
padding: var(--faq-space-3) var(--faq-space-4);
|
|
font-size: var(--faq-question-size);
|
|
font-weight: 600;
|
|
line-height: 1.4;
|
|
color: var(--faq-color-text);
|
|
cursor: pointer;
|
|
list-style: none;
|
|
overflow-wrap: anywhere;
|
|
}
|
|
|
|
.faq-item__question::-webkit-details-marker {
|
|
display: none;
|
|
}
|
|
|
|
.faq-item__question::after {
|
|
flex-shrink: 0;
|
|
width: 0.55rem;
|
|
height: 0.55rem;
|
|
border-right: 2px solid var(--faq-color-text);
|
|
border-bottom: 2px solid var(--faq-color-text);
|
|
transform: rotate(45deg);
|
|
transition: transform 150ms ease;
|
|
content: '';
|
|
}
|
|
|
|
.faq-item[open] > .faq-item__question::after {
|
|
transform: rotate(-135deg);
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.faq-item__question::after {
|
|
transition: none;
|
|
}
|
|
}
|
|
|
|
.faq-item__question:focus-visible {
|
|
outline: 2px solid var(--faq-color-accent);
|
|
outline-offset: 2px;
|
|
border-radius: var(--faq-radius);
|
|
}
|
|
|
|
.faq-item__answer {
|
|
padding: 0 var(--faq-space-4) var(--faq-space-4);
|
|
}
|
|
|
|
/* Answer and description HTML (the PHP partial's rules, ported). */
|
|
.faq-html p,
|
|
.faq-html ul,
|
|
.faq-html ol {
|
|
margin: 0 0 var(--faq-space-3);
|
|
}
|
|
|
|
.faq-html > :last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.faq-html ul {
|
|
list-style: disc;
|
|
padding-inline-start: 1.25rem;
|
|
}
|
|
|
|
.faq-html ol {
|
|
list-style: decimal;
|
|
padding-inline-start: 1.25rem;
|
|
}
|
|
|
|
.faq-html li + li {
|
|
margin-top: var(--faq-space-2);
|
|
}
|
|
|
|
.faq-html a {
|
|
color: var(--faq-color-accent);
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.faq-html a:focus-visible {
|
|
outline: 2px solid var(--faq-color-accent);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
.faq-html h3 {
|
|
margin: 0 0 var(--faq-space-2);
|
|
font-size: var(--faq-question-size);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.faq-html blockquote {
|
|
margin: 0 0 var(--faq-space-3);
|
|
padding-inline-start: var(--faq-space-3);
|
|
border-inline-start: 3px solid var(--faq-color-border);
|
|
color: var(--faq-color-muted);
|
|
}
|