Skip to content

Commit fed337e

Browse files
committed
doc: Theme fixes
Theme fixes Signed-off-by: Uma Praseeda <uma.praseeda@nordicsemi.no>
1 parent 5c10463 commit fed337e

3 files changed

Lines changed: 149 additions & 45 deletions

File tree

sphinx_ncs_theme/layout.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@
138138
target="_blank"
139139
rel="noopener noreferrer"
140140
class="btn ncs-btn-header">
141-
<span class="ncs-label-long">{{ theme_ncs_label | default('nRF Connect SDK') }}</span>
142-
<span class="ncs-label-short">NCS</span>
141+
<span class="ncs-label-long">{{ theme_ncs_label | default('nRF Connect Docs') }}</span>
142+
<span class="ncs-label-short">nRF Connect Docs</span>
143143
</a>
144144
{%- endif %}
145145
</div>

sphinx_ncs_theme/static/css/nordic.css

Lines changed: 137 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,12 @@ kbd {
430430
.ncs-header-top .row > .col-md-6 {
431431
justify-content: flex-start !important;
432432
padding-left: 0 !important;
433-
margin-left: -11rem !important;
433+
margin-left: -1rem !important;
434434
}
435435
.ncs-header-top .row > .col-8 form,
436436
.ncs-header-top .row > .col-md-6 form {
437437
margin-left: 0 !important;
438-
margin-right: auto !important;
438+
/* margin-right: auto !important; */
439439
width: 100%;
440440
max-width: 100%;
441441
}
@@ -455,10 +455,10 @@ kbd {
455455
.ncs-header-top .row > .col-8 .form-control,
456456
.ncs-header-top .row > .col-md-6 .ncs-search-input,
457457
.ncs-header-top .row > .col-md-6 .form-control {
458-
max-width: 100%;
458+
max-width: 98%;
459459
box-sizing: border-box;
460-
min-width: 12rem;
461-
margin-left: 0.25rem;
460+
/* min-width: 50rem; */
461+
margin-left: 0.35rem;
462462
}
463463

464464
/* Logo image: constrained to header, same look as docs.nordicsemi.com */
@@ -645,15 +645,26 @@ kbd {
645645
@media screen and (max-width: 1999px) {
646646
.ncs-header-top .row > .col-4 .dropdown,
647647
.ncs-header-top .row > .col-md-4 .dropdown {
648-
margin-right: 0.75rem;
648+
margin-right: 0;
649649
}
650650
}
651651
.ncs-header-top .row > .col-md-4.d-flex > .dropdown {
652-
margin-right: -62px;
652+
/*margin-right: -62px;*/
653+
margin-right: 5px;
653654
}
654655
.ncs-header-top .ncs-btn-versions {
655656
margin-right: 0;
656657
}
658+
/* Versions dropdown: wrapper/menu match toggle width */
659+
.ncs-header-top .dropdown:has(.ncs-btn-versions) {
660+
width: fit-content;
661+
max-width: 100%;
662+
}
663+
.ncs-header-top .dropdown:has(.ncs-btn-versions) .dropdown-menu {
664+
width: 100%;
665+
min-width: fit-content;
666+
box-sizing: border-box;
667+
}
657668
.ncs-btn-header:hover {
658669
background-color: #e0f4f9 !important;
659670
color: #0033a0 !important;
@@ -702,11 +713,12 @@ kbd {
702713
min-width: 45rem;
703714
max-width: fit-content !important;
704715
box-sizing: border-box;
705-
margin-left: -0.25rem !important;
716+
margin-left: -1.25rem !important;
706717
}
707718
.ncs-search-input,
708719
.ncs-search-input:focus {
709720
font-size: 0.875rem !important; /* 14px; use 0.8125rem for 13px if you want even more room */
721+
/* width: 100% !important; */
710722
}
711723

712724
.ncs-btn-versions,
@@ -725,7 +737,7 @@ kbd {
725737
}
726738
}
727739
/* Button labels: long text when in a row (≥1680px), short when stacked or smaller (≤1679px) */
728-
@media screen and (min-width: 1680px) {
740+
@media screen and (min-width: 1200px) {
729741
.ncs-header-top .ncs-label-short {
730742
display: none !important;
731743
}
@@ -735,16 +747,16 @@ kbd {
735747
}
736748
@media screen and (max-width: 1679px) {
737749
.ncs-header-top .ncs-label-long {
738-
display: none !important;
750+
display: inline!important;
739751
}
740752
.ncs-header-top .ncs-label-short {
741-
display: inline;
753+
display: none;
742754
}
743755
}
744756
/* From 1199px: buttons on the right, natural width */
745757
@media screen and (min-width: 1199px) {
746758
.ncs-header-top .row > .col-8 form {
747-
max-width: 100%;
759+
/* max-width: 96% !important; */
748760
}
749761
.ncs-header-top .dropdown,
750762
.ncs-header-top .ncs-btn-header {
@@ -758,6 +770,7 @@ kbd {
758770
.ncs-header-top .row > .col-4.d-flex,
759771
.ncs-header-top .row > .col-md-4.d-flex {
760772
justify-content: flex-end !important;
773+
gap: 8px !important;
761774
}
762775
.ncs-header-top .dropdown {
763776
width: auto !important;
@@ -771,10 +784,10 @@ kbd {
771784

772785
}
773786
/* Keep search bar from shrinking so buttons stay to the right of it (no overlap) */
774-
@media screen and (min-width: 1200px) {
787+
@media screen and (min-width: 1550px) {
775788
.ncs-header-top .row > .col-8,
776789
.ncs-header-top .row > .col-md-6 {
777-
min-width: 12rem;
790+
min-width: 8rem;
778791
max-width: 50rem;
779792
}
780793
}
@@ -783,12 +796,12 @@ kbd {
783796
.ncs-header-top .row > .col-4,
784797
.ncs-header-top .row > .col-md-4 {
785798
align-self: center !important;
786-
margin-top: 3.35rem !important;
799+
margin-top: 51px!important;
787800
}
788801
}
789802

790803
/* From 1680px: 3 buttons in one row at the rightmost end; shrink with ellipsis when needed */
791-
@media screen and (min-width: 1680px) {
804+
@media screen and (min-width: 2000px) {
792805
.ncs-header-top .row > .col-8,
793806
.ncs-header-top .row > .col-md-6 {
794807
margin-left: auto !important;
@@ -801,37 +814,37 @@ kbd {
801814
.ncs-header-top .row > .col-md-4 {
802815
min-width: 0;
803816
max-width: 50%;
804-
overflow: hidden;
817+
overflow: visible;
805818
margin-left: auto;
806819
margin-right: 0;
807820
}
808821
.ncs-header-top .row .col-4.d-flex,
809822
.ncs-header-top .row .col-md-4.d-flex {
810-
/*width: 100%;*/
823+
/* width: 100%; */
811824
/*flex-wrap: wrap;*/
812825
gap: 0.75rem !important;
813826
justify-content: center !important;
814827
}
815828
.ncs-header-top .row > .col-md-4.d-flex .dropdown,
816829
.ncs-header-top .row > .col-md-4.d-flex .ncs-btn-header {
817830
flex-shrink: 1 !important;
818-
min-width: 10rem !important;
831+
min-width: 10.5rem !important;
819832
max-width: 100%;
820833
}
821834
.ncs-header-top .row > .col-md-4 .dropdown .ncs-btn-versions,
822835
.ncs-header-top .row > .col-md-4 .ncs-btn-header {
823-
min-width: 0 !important;
836+
min-width: 10rem !important;
824837
overflow: hidden;
825838
text-overflow: ellipsis;
826839
}
827840
}
828841
/* 1200px–1679px: same row, but buttons stack in 3 rows on the right; ≥1680px = 3 buttons in one row */
829-
@media screen and (max-width: 1886px) and (min-width: 1200px) {
842+
@media screen and (max-width: 1886px) and (min-width: 1550) {
830843
.ncs-header-top .row > .col-8,
831844
.ncs-header-top .row > .col-md-6 {
832-
margin-left: 0 !important;
845+
margin-left: -6px !important;
833846
min-width: 0 !important;
834-
max-width: 100%;
847+
/*max-width: 100%;*/
835848
}
836849
.ncs-header-top .row > .col-8 .ncs-search-input,
837850
.ncs-header-top .row > .col-8 .form-control,
@@ -841,33 +854,37 @@ kbd {
841854
}
842855
.ncs-header-top .row .col-4.d-flex,
843856
.ncs-header-top .row .col-md-4.d-flex {
844-
flex-direction: column !important;
857+
flex-direction: row !important;
845858
flex-wrap: nowrap !important;
846859
align-items: stretch !important;
847860
align-self: flex-start;
848-
margin-right: 12rem;
861+
/*margin-right: 12rem;*/
849862
/*justify-content: flex-start;*/
850-
gap: 0.25rem !important;
863+
gap: 10px !important;
851864
min-width: 0;
852865
max-width: 100%;
853-
width:20%;
866+
/*width:20%;*/
854867
padding-bottom: 3.5rem !important;
868+
margin-top:90px !important;
869+
margin-left: -11px;
855870
}
856871
.ncs-header-top .row > .col-md-4 .dropdown,
857872
.ncs-header-top .row > .col-md-4 .ncs-btn-header {
858-
width: 100%;
873+
/*width: 100%;*/
859874
min-width: 0;
860875
flex-shrink: 0;
861876
box-sizing: border-box;
877+
margin-right:10px !important;
862878
}
863-
.ncs-header-top .row > .col-md-4 .dropdown {
879+
/*.ncs-header-top .row > .col-md-4 .dropdown {
864880
width: 100% !important;
865-
}
881+
}*/
866882
.ncs-header-top .row > .col-md-4 .dropdown .ncs-btn-versions {
867883
width: 100% !important;
868884
box-sizing: border-box;
869885
justify-content: center;
870886
text-align: center;
887+
min-width:10rem;
871888
}
872889
}
873890
/* Keep header search + buttons on one line until very small screens
@@ -939,15 +956,15 @@ kbd {
939956
.ncs-header-top .row > .col-4.d-flex,
940957
.ncs-header-top .row > .col-md-4.d-flex {
941958
min-width: 0 !important;
942-
max-width: 33.5% !important;
959+
max-width: 33% !important;
943960
padding-top: .5rem !important;
944-
padding-bottom: 2px !important;
945-
961+
padding-bottom: 2px !important;
962+
margin-right: 11px;
946963
}
947964
.ncs-header-top .row > .col-md-4 .dropdown,
948965
.ncs-header-top .row > .col-md-4 .ncs-btn-header {
949966
flex: 0 0 auto;
950-
min-width: 0;
967+
min-width: 100%;
951968
max-width: 100%;
952969
margin-right: 0px !important;
953970
}
@@ -1368,7 +1385,7 @@ kbd {
13681385
.wy-side-scroll::-webkit-scrollbar,
13691386
.wy-nav-content-wrap::-webkit-scrollbar,
13701387
.wy-nav-content::-webkit-scrollbar {
1371-
width: 10px;
1388+
width: 5px;
13721389
}
13731390
.wy-side-scroll::-webkit-scrollbar-thumb,
13741391
.wy-nav-content-wrap::-webkit-scrollbar-thumb,
@@ -1481,7 +1498,7 @@ div[role="navigation"] hr {
14811498
margin-top: 0.5rem;
14821499
margin-bottom: 0.5rem;
14831500
/* Bleed into .wy-nav-content horizontal padding (must match that rule) */
1484-
margin-left: -3em;
1501+
margin-left: -2em;
14851502
margin-right: calc(-1 * max(2em, 4.5rem));
14861503
width: calc(100% + 2em + max(2em, 4.5rem));
14871504
max-width: none;
@@ -2485,11 +2502,14 @@ nav.contents.local .ncs-local-toc-tool .ncs-local-toc-icon {
24852502
justify-content: center;
24862503
gap: 0px;
24872504
line-height: 1;
2488-
flex-shrink: 0;
2505+
/*flex-shrink: 0;*/
24892506
}
24902507
.wy-side-scroll .ncs-sidebar-toc-btn .ncs-local-toc-guillemet {
24912508
display: block;
2492-
font-size: 1.1rem;
2509+
font-size: 1em;
2510+
gap:3px;
2511+
align-items:center;
2512+
justify-content:center;
24932513
line-height: 1;
24942514
color: #000;
24952515
}
@@ -2498,15 +2518,15 @@ nav.contents.local .ncs-local-toc-tool .ncs-local-toc-icon {
24982518
color: #0077c8;
24992519
}
25002520
.wy-side-scroll .ncs-sidebar-toc-btn .ncs-local-toc-guillemet--up {
2501-
transform: rotate(-90deg) translateY(1.5px);
2521+
transform: rotate(-90deg);
25022522
transform-origin: center;
25032523
}
25042524
.wy-side-scroll .ncs-sidebar-toc-btn .ncs-local-toc-guillemet--down {
2505-
transform: rotate(90deg) translateY(-4.45px);
2525+
transform: rotate(90deg) translateY(-5px);
25062526
transform-origin: center;
25072527
}
25082528
.wy-side-scroll .ncs-sidebar-toc-btn .ncs-local-toc-guillemet + .ncs-local-toc-guillemet {
2509-
margin-top: -10px;
2529+
margin-top: -13px;
25102530
}
25112531
.wy-side-scroll span.ncs-sidebar-toc-btn__label {
25122532
font-size: 14px;
@@ -3257,4 +3277,79 @@ span.guilabel {
32573277
}
32583278
.rst-content table.docutils td code {
32593279
border: 1px solid #dae2e3 !important;
3260-
}
3280+
}
3281+
3282+
@media screen and (min-width: 1550px) {
3283+
.ncs-header-top .row > .col-md-6,
3284+
.ncs-header-top .row > .col-8 {
3285+
flex: 1 1 0%;
3286+
min-width: 0;
3287+
max-width: none; /* relax 50rem cap from ~785–790 if still present */
3288+
}
3289+
3290+
.ncs-header-top .row > .col-md-6 .ncs-search-input,
3291+
.ncs-header-top .row > .col-md-6 .form-control {
3292+
width: 100%;
3293+
max-width: 100%;
3294+
min-width: 0; /* overrides 12rem */
3295+
}
3296+
3297+
.ncs-header-top .row > .col-md-4.d-flex {
3298+
flex: 0 0 auto;
3299+
flex-shrink: 0;
3300+
}
3301+
3302+
.ncs-header-top .dropdown,
3303+
.ncs-header-top .ncs-btn-header {
3304+
flex-shrink: 0; /* keep long text readable; already partly at ~756 */
3305+
}
3306+
}
3307+
.ncs-header-top .row > .col-md-6 form {
3308+
max-width: min(100%, clamp(10rem, 30vw, 42rem));
3309+
}
3310+
3311+
/* Short labels while search + buttons share one row, 1200px–1400px */
3312+
@media screen and (min-width: 1200px) and (max-width: 1500px) {
3313+
.ncs-header-top .ncs-label-long {
3314+
display: none!important;
3315+
}
3316+
.ncs-header-top .ncs-label-short {
3317+
display: inline!important;
3318+
}
3319+
}
3320+
@media screen and (max-width: 1199px) {
3321+
/* Let form + input use full column width (beats clamp at end of file) */
3322+
.ncs-header-top .row > .col-md-6 form,
3323+
.ncs-header-top .row > .col-8 form {
3324+
width: 100% !important;
3325+
max-width: 100% !important;
3326+
}
3327+
3328+
/* Widen button row so search can match it */
3329+
.ncs-header-top .row > .col-md-4.d-flex,
3330+
.ncs-header-top .row > .col-4.d-flex {
3331+
width: 100% !important;
3332+
max-width: 100% !important;
3333+
align-self: center;
3334+
}
3335+
3336+
.ncs-header-top .row > .col-md-4 .dropdown,
3337+
.ncs-header-top .row > .col-md-4 .ncs-btn-header {
3338+
width: 32%!important;
3339+
min-width: auto !important;
3340+
max-width: none !important;
3341+
}
3342+
3343+
/* Search column: as wide as content / button row, centered */
3344+
.ncs-header-top .row > .col-md-6.ncs-header-search-col,
3345+
.ncs-header-top .row > .col-8.ncs-header-search-col {
3346+
/* width: 50% !important; */
3347+
max-width: 100% !important;
3348+
align-self: center !important;
3349+
/* justify-items: center; */
3350+
/* margin-left: 235px !important; */
3351+
min-width: min(100%, 28rem); /* optional floor; tune or remove */
3352+
}
3353+
3354+
3355+
}

0 commit comments

Comments
 (0)