forge
Explore
Log in

Don't you dare go Hollow

New repository toggle names the chosen visibility and fields line up

Browse files at this commit

c8bdbe06dca2cc22945403dc5c0e462a124816baAhmet Kaan GümüşParent: bcaef90
  • style
    • new repository toggle names the chosen visibility and fields line up
Show full message
💄 style: new repository toggle names the chosen visibility and fields line up

The selected visibility segment opens its word beside the icon, with a
CSS transition that respects reduced motion. The Imports tab sits with
the other tabs, the default branch field is as wide as the other fields,
and the default labels checkbox aligns with its first line.
crates/forge-web/src/pages/import.rsmodified+1 -1
@@ -161,7 +161,7 @@ pub(crate) async fn newrepo_tabs(lang: Lang, active: &str) -> Result<impl View>
161 <nav class="import-tabs" aria-label=(g::t(lang, K::ImportTitle))>161 <nav class="import-tabs" aria-label=(g::t(lang, K::ImportTitle))>
162 <a href="/new" class="import-tab" aria-current=(create.then_some("page"))>(g::t(lang, K::TabCreate))</a>162 <a href="/new" class="import-tab" aria-current=(create.then_some("page"))>(g::t(lang, K::TabCreate))</a>
163 <a href="/new/import" class="import-tab" aria-current=(import.then_some("page"))>(g::t(lang, K::TabImport))</a>163 <a href="/new/import" class="import-tab" aria-current=(import.then_some("page"))>(g::t(lang, K::TabImport))</a>
164- <a href="/import" class="import-tab import-tab-end">(g::t(lang, K::JobsLink))</a>164+ <a href="/import" class="import-tab">(g::t(lang, K::JobsLink))</a>
165 </nav>165 </nav>
166 })166 })
167 }167 }
style/_import.scssmodified+0 -4
@@ -28,10 +28,6 @@
28 color: var(--accent-ink);28 color: var(--accent-ink);
29 border-bottom-color: var(--accent);29 border-bottom-color: var(--accent);
30 }30 }
31-
32- &.import-tab-end {
33- margin-left: auto;
34- }
35 }31 }
36 32
37 .import-sources {33 .import-sources {
style/_repo.scssmodified+63 -6
@@ -593,8 +593,65 @@
593 height: var(--control-h);593 height: var(--control-h);
594 }594 }
595 595
596- .segment > span {596+ // A drawer: the selected segment is the pill and opens its word beside the icon. The other
597+ // segment stays icon only. The highlight sits on the segment, so the icon is inside it. The
598+ // selectors repeat .segmented to outrank the shared pill rules in main.scss.
599+ .segmented .segment {
597 height: calc(var(--control-h) - 6px);600 height: calc(var(--control-h) - 6px);
601+ padding: 0 9px;
602+ border-radius: var(--radius-full);
603+ transition: background-color 0.2s ease, box-shadow 0.2s ease;
604+
605+ > svg {
606+ position: static;
607+ flex: none;
608+ transform: none;
609+ }
610+
611+ > span {
612+ display: inline-flex;
613+ align-items: center;
614+ box-sizing: border-box;
615+ width: auto;
616+ max-width: 0;
617+ height: calc(var(--control-h) - 6px);
618+ padding: 0;
619+ overflow: hidden;
620+ font-size: 0.8125rem;
621+ line-height: 1;
622+ opacity: 0;
623+ transition: max-width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
624+ }
625+
626+ input[type="radio"]:checked ~ span {
627+ background: none;
628+ box-shadow: none;
629+ }
630+
631+ &:has(input[type="radio"]:checked) {
632+ background: var(--surface);
633+ color: var(--accent-ink);
634+ box-shadow: 0 1px 2px rgba(30, 36, 32, .12);
635+ }
636+
637+ &:has(input[type="radio"]:focus-visible) {
638+ box-shadow: 0 0 0 2px var(--focus);
639+ }
640+
641+ // The word opens only for the chosen segment, so the other one stays a plain icon.
642+ &:has(input[type="radio"]:checked) > span {
643+ max-width: 8em;
644+ padding: 0 10px 0 6px;
645+ opacity: 1;
646+ color: var(--accent-ink);
647+ }
648+ }
649+
650+ @media (prefers-reduced-motion: reduce) {
651+ .segmented .segment,
652+ .segmented .segment > span {
653+ transition: none;
654+ }
598 }655 }
599 }656 }
600 657
@@ -647,16 +704,16 @@
647 color: var(--muted);704 color: var(--muted);
648 }705 }
649 706
707+// Stacked like the other fields, so the branch input is as wide as the name and description.
650 .newrepo-options {708 .newrepo-options {
709+ flex-direction: column;
710+ align-items: stretch;
711+
651 .newrepo-branch {712 .newrepo-branch {
652- flex: 0 1 240px;
653 min-width: 0;713 min-width: 0;
654 }714 }
655 715
656 .newrepo-labels {716 .newrepo-labels {
657- align-self: flex-end;
658- align-items: center;
659- min-height: var(--control-h);
660 margin: 0;717 margin: 0;
661 }718 }
662 }719 }
@@ -731,7 +788,7 @@
731 }788 }
732 789
733 @media (max-width: 480px) {790 @media (max-width: 480px) {
734- // Below 480px the visibility switch shows icons only, so Create fits beside it.791+ // Below 480px the visibility pill and Create share one row, spread to the edges.
735 .newrepo-head-actions {792 .newrepo-head-actions {
736 justify-content: space-between;793 justify-content: space-between;
737 margin-left: 0;794 margin-left: 0;