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>
161161 <nav class="import-tabs" aria-label=(g::t(lang, K::ImportTitle))>
162162 <a href="/new" class="import-tab" aria-current=(create.then_some("page"))>(g::t(lang, K::TabCreate))</a>
163163 <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>
165165 </nav>
166166 })
167167 }
style/_import.scssmodified+0 -4
@@ -28,10 +28,6 @@
2828 color: var(--accent-ink);
2929 border-bottom-color: var(--accent);
3030 }
31-
32- &.import-tab-end {
33- margin-left: auto;
34- }
3531 }
3632
3733 .import-sources {
style/_repo.scssmodified+63 -6
@@ -593,8 +593,65 @@
593593 height: var(--control-h);
594594 }
595595
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 {
597600 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+ }
598655 }
599656 }
600657
@@ -647,16 +704,16 @@
647704 color: var(--muted);
648705 }
649706
707+// Stacked like the other fields, so the branch input is as wide as the name and description.
650708 .newrepo-options {
709+ flex-direction: column;
710+ align-items: stretch;
711+
651712 .newrepo-branch {
652- flex: 0 1 240px;
653713 min-width: 0;
654714 }
655715
656716 .newrepo-labels {
657- align-self: flex-end;
658- align-items: center;
659- min-height: var(--control-h);
660717 margin: 0;
661718 }
662719 }
@@ -731,7 +788,7 @@
731788 }
732789
733790 @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.
735792 .newrepo-head-actions {
736793 justify-content: space-between;
737794 margin-left: 0;