Skip to content

Commit a00fa2e

Browse files
fix: move FrameworkSelector + ConditionalQuestionnaire styles to docs.css for production builds (#472)
* fix: move component styles to docs.css to survive Astro MDX build * refactor: remove redundant style blocks from components (styles live in docs.css) * fix: scope .sl-steps to #questionnaire-steps and add :focus-visible to interactive buttons - Scope all .sl-steps selectors under #questionnaire-steps to avoid overriding Starlight's native step component styles elsewhere - Add :focus-visible outlines to .framework-button, .question-btn, and .react-framework-buttons .framework-button for keyboard accessibility Addresses CodeRabbit review feedback on PR #472. * fix: match question-btn font to page body text Change font-family from var(--sl-font) to inherit so buttons get the full Starlight font stack with fallbacks. Bump font-size from var(--sl-text-sm) to var(--sl-text-body) to match surrounding text. * fix: add monospace fallback stack to questionnaire code blocks var(--sl-font-mono) only resolves to 'IBM Plex Mono' without fallbacks. When that font isn't loaded, code blocks fall back to the browser's default proportional font. Add the same fallback stack Starlight uses for its own <code> elements.
1 parent cdb1fb1 commit a00fa2e

File tree

3 files changed

+391
-391
lines changed

3 files changed

+391
-391
lines changed

src/components/ConditionalQuestionnaire.astro

Lines changed: 1 addition & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -672,227 +672,7 @@ export default component$(() => {
672672
</ol>
673673
</div>
674674

675-
<style is:global>
676-
/* Custom Steps Styling (copied from Starlight) */
677-
.sl-steps {
678-
--bullet-size: calc(var(--sl-line-height) * 1rem);
679-
--bullet-margin: 0.375rem;
680-
681-
list-style: none;
682-
counter-reset: steps-counter var(--sl-steps-start, 0);
683-
padding-inline-start: 0;
684-
}
685-
686-
.sl-steps > ol {
687-
list-style: none;
688-
padding-inline-start: 0;
689-
margin: 0;
690-
}
691-
692-
.sl-steps > ol > li {
693-
counter-increment: steps-counter;
694-
position: relative;
695-
padding-inline-start: calc(var(--bullet-size) + 1rem);
696-
padding-bottom: 1px;
697-
min-height: calc(var(--bullet-size) + var(--bullet-margin));
698-
}
699-
700-
.sl-steps > ol > li + li {
701-
margin-top: 0;
702-
}
703-
704-
/* Custom list marker element */
705-
.sl-steps > ol > li::before {
706-
content: counter(steps-counter);
707-
position: absolute;
708-
top: 0;
709-
inset-inline-start: 0;
710-
width: var(--bullet-size);
711-
height: var(--bullet-size);
712-
line-height: var(--bullet-size);
713-
714-
font-size: var(--sl-text-xs);
715-
font-weight: 600;
716-
text-align: center;
717-
color: var(--sl-color-white);
718-
background-color: var(--sl-color-gray-6);
719-
border-radius: 99rem;
720-
box-shadow: inset 0 0 0 1px var(--sl-color-gray-5);
721-
}
722-
723-
/* Vertical guideline linking list numbers */
724-
.sl-steps > ol > li::after {
725-
--guide-width: 1px;
726-
content: '';
727-
position: absolute;
728-
top: calc(var(--bullet-size) + var(--bullet-margin));
729-
bottom: var(--bullet-margin);
730-
inset-inline-start: calc((var(--bullet-size) - var(--guide-width)) / 2);
731-
width: var(--guide-width);
732-
background-color: var(--sl-color-hairline-light);
733-
}
734-
735-
/* Adjust first item inside a step */
736-
.sl-steps > ol > li > :first-child {
737-
--lh: calc(1em * var(--sl-line-height));
738-
--shift-y: calc(0.5 * (var(--bullet-size) - var(--lh)));
739-
transform: translateY(var(--shift-y));
740-
margin-bottom: var(--shift-y);
741-
}
742-
743-
/* Question buttons styling */
744-
.question-buttons {
745-
display: flex;
746-
gap: 0.5rem;
747-
flex-wrap: wrap;
748-
margin-top: 1rem;
749-
}
750-
751-
.question-btn {
752-
background: var(--sl-color-gray-6);
753-
color: var(--sl-color-gray-1);
754-
border: 1px solid var(--sl-color-gray-5);
755-
border-radius: 0.375rem;
756-
padding: 0.75rem 1rem;
757-
cursor: pointer;
758-
transition: all 0.2s ease;
759-
font-family: var(--sl-font);
760-
font-size: var(--sl-text-sm);
761-
margin: 0;
762-
}
763-
764-
.question-btn:hover {
765-
border-color: var(--sl-color-blue);
766-
background-color: var(--sl-color-gray-5);
767-
}
768-
769-
.question-btn.selected {
770-
border-color: var(--sl-color-blue);
771-
background-color: var(--sl-color-blue);
772-
color: white;
773-
}
774-
775-
.script-type-buttons {
776-
flex-direction: column;
777-
align-items: flex-start;
778-
}
779-
780-
.script-type-buttons .question-btn {
781-
font-family: monospace;
782-
}
783-
784-
/* React framework buttons styling */
785-
.react-framework-buttons {
786-
display: flex;
787-
flex-wrap: wrap;
788-
justify-content: center;
789-
align-items: stretch;
790-
gap: 10px;
791-
margin-top: 1rem;
792-
}
793-
794-
.react-framework-buttons .framework-button {
795-
flex: 0 0 calc(25% - 7.5px);
796-
max-width: 200px;
797-
min-height: 120px;
798-
padding: 1rem;
799-
border: 2px solid var(--sl-color-gray-5);
800-
border-radius: 8px;
801-
background-color: var(--sl-color-black);
802-
color: var(--sl-color-white);
803-
cursor: pointer;
804-
transition: all 0.2s ease;
805-
display: flex;
806-
flex-direction: column;
807-
align-items: center;
808-
justify-content: center;
809-
text-align: center;
810-
margin: 0;
811-
}
812-
813-
.react-framework-buttons .framework-icon {
814-
width: 48px;
815-
height: 48px;
816-
margin-bottom: 0.5rem;
817-
display: flex;
818-
align-items: center;
819-
justify-content: center;
820-
}
821-
822-
.react-framework-buttons .framework-icon img {
823-
width: 100%;
824-
height: 100%;
825-
object-fit: contain;
826-
}
827-
828-
.react-framework-buttons .framework-name {
829-
font-size: 0.875rem;
830-
font-weight: 500;
831-
line-height: 1.2;
832-
}
833-
834-
.react-framework-buttons .framework-button:hover {
835-
border-color: var(--sl-color-blue);
836-
background-color: var(--sl-color-gray-6);
837-
}
838-
839-
.react-framework-buttons .framework-button.selected {
840-
border-color: var(--sl-color-blue);
841-
background-color: var(--sl-color-blue);
842-
color: white;
843-
}
844-
845-
/* Warning styling */
846-
.questionnaire-warning {
847-
margin-top: 1rem;
848-
}
849-
850-
/* Code block styling */
851-
.questionnaire-code {
852-
margin-top: 1rem;
853-
}
854-
855-
.questionnaire-code pre {
856-
background: var(--sl-color-gray-6);
857-
border-radius: 0.375rem;
858-
padding: 1rem;
859-
overflow-x: auto;
860-
}
861-
862-
.questionnaire-code code {
863-
font-family: var(--sl-font-mono);
864-
font-size: var(--sl-text-sm);
865-
color: var(--sl-color-gray-1);
866-
white-space: pre-wrap;
867-
line-height: 1.1;
868-
display: block;
869-
}
870-
871-
.questionnaire-code .diff-line {
872-
padding: 0 0.5rem;
873-
margin: 0;
874-
line-height: 1.1;
875-
min-height: 1.1em;
876-
}
877-
878-
.questionnaire-code .diff-added {
879-
background-color: rgba(34, 197, 94, 0.2);
880-
color: #22c55e;
881-
border-left: 3px solid #22c55e;
882-
padding: 0 calc(0.5rem - 3px);
883-
line-height: 1.1;
884-
min-height: 1.1em;
885-
}
886-
887-
.questionnaire-code .diff-removed {
888-
background-color: rgba(239, 68, 68, 0.2);
889-
color: #ef4444;
890-
border-left: 3px solid #ef4444;
891-
padding: 0 calc(0.5rem - 3px);
892-
line-height: 1.1;
893-
min-height: 1.1em;
894-
}
895-
</style>
675+
<!-- Styles live in src/css/docs.css (Astro drops component <style> blocks from MDX pages during build) -->
896676

897677
<script is:inline define:vars={{ questionFlow }}>
898678
document.addEventListener('DOMContentLoaded', function () {

0 commit comments

Comments
 (0)