Skip to content

Commit 8913885

Browse files
authored
Merge pull request #15 from github/skarim/docs-updates
docs updates
2 parents 7fd5e09 + 19e3549 commit 8913885

File tree

19 files changed

+313
-93
lines changed

19 files changed

+313
-93
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Stack metadata is stored in `.git/gh-stack` (a JSON file, not committed to the r
6969
Initialize a new stack in the current repository.
7070

7171
```
72-
gh stack init [branches...] [flags]
72+
gh stack init [flags] [branches...]
7373
```
7474

7575
Creates an entry in `.git/gh-stack` to track stack state. In interactive mode (no arguments), prompts you to name branches and offers to use the current branch as the first layer. In interactive mode, you'll also be prompted to set an optional branch prefix (unless adopting existing branches). When a prefix is set, branch names you enter are automatically prefixed. When explicit branch names are given, creates any that don't already exist (branching from the trunk). The trunk defaults to the repository's default branch unless overridden with `--base`.
@@ -115,7 +115,7 @@ gh stack init -p feat --numbered
115115
Add a new branch on top of the current stack.
116116

117117
```
118-
gh stack add [branch] [flags]
118+
gh stack add [flags] [branch]
119119
```
120120

121121
Creates a new branch at the current HEAD, adds it to the top of the stack, and checks it out. Must be run while on the topmost branch of a stack. If no branch name is given, prompts for one.
@@ -190,7 +190,7 @@ gh stack checkout
190190
Pull from remote and do a cascading rebase across the stack.
191191

192192
```
193-
gh stack rebase [branch] [flags]
193+
gh stack rebase [flags] [branch]
194194
```
195195

196196
Fetches the latest changes from `origin`, then ensures each branch in the stack has the tip of the previous layer in its commit history. Rebases branches in order from trunk upward. If a branch's PR has been squash-merged, the rebase automatically switches to `--onto` mode to correctly replay commits on top of the merge target.
@@ -331,7 +331,7 @@ gh stack view --json
331331
Remove a stack from local tracking and delete it on GitHub. Also available as `gh stack delete`.
332332

333333
```
334-
gh stack unstack [branch] [flags]
334+
gh stack unstack [flags] [branch]
335335
```
336336

337337
If no branch is specified, uses the current branch to find the stack. Deletes the stack on GitHub first, then removes local tracking. Use `--local` to only remove the local tracking entry.
@@ -414,7 +414,7 @@ gh stack feedback "Support for reordering branches"
414414
Create a short command alias so you can type less.
415415

416416
```
417-
gh stack alias [name] [flags]
417+
gh stack alias [flags] [name]
418418
```
419419

420420
Installs a small wrapper script into `~/.local/bin/` that forwards all arguments to `gh stack`. The default alias name is `gs`, but you can choose any name by passing it as an argument. After setup, you can run `gs push` instead of `gh stack push`.

cmd/feedback.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import (
99
"github.com/spf13/cobra"
1010
)
1111

12-
const feedbackBaseURL = "https://github.com/github/gh-stack/discussions/new?category=feedback"
12+
const (
13+
feedbackURL = "https://gh.io/stacks-feedback"
14+
feedbackFormURL = "https://gh.io/stacks-feedback-form"
15+
)
1316

1417
func FeedbackCmd(cfg *config.Config) *cobra.Command {
1518
cmd := &cobra.Command{
@@ -25,15 +28,15 @@ func FeedbackCmd(cfg *config.Config) *cobra.Command {
2528
}
2629

2730
func runFeedback(cfg *config.Config, args []string) error {
28-
feedbackURL := feedbackBaseURL
31+
targetURL := feedbackURL
2932

3033
if len(args) > 0 {
3134
title := strings.Join(args, " ")
32-
feedbackURL += "&title=" + url.QueryEscape(title)
35+
targetURL = feedbackFormURL + "?title=" + url.QueryEscape(title)
3336
}
3437

3538
b := browser.New("", cfg.Out, cfg.Err)
36-
if err := b.Browse(feedbackURL); err != nil {
39+
if err := b.Browse(targetURL); err != nil {
3740
return err
3841
}
3942

cmd/submit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func generatePRBody(commitBody string) string {
230230

231231
footer := fmt.Sprintf(
232232
"<sub>Stack created with <a href=\"https://github.com/github/gh-stack\">GitHub Stacks CLI</a> • <a href=\"%s\">Give Feedback 💬</a></sub>",
233-
feedbackBaseURL,
233+
feedbackURL,
234234
)
235235
parts = append(parts, footer)
236236

cmd/submit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestGeneratePRBody(t *testing.T) {
2626
commitBody: "",
2727
wantContains: []string{
2828
"GitHub Stacks CLI",
29-
feedbackBaseURL,
29+
feedbackURL,
3030
"<sub>",
3131
},
3232
},

docs/astro.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export default defineConfig({
1818
head: [
1919
{ tag: 'meta', attrs: { name: 'robots', content: 'noindex, nofollow' } },
2020
],
21+
components: {
22+
SocialIcons: './src/components/CustomHeader.astro',
23+
},
2124
customCss: [
2225
'./src/styles/custom.css',
2326
],
Binary file not shown.
2.18 KB
Loading
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
import Default from '@astrojs/starlight/components/SocialIcons.astro';
3+
const base = import.meta.env.BASE_URL;
4+
---
5+
6+
<nav class="custom-header-links" aria-label="Primary navigation">
7+
<a href={`${base}introduction/overview/`} class="header-link">Overview</a>
8+
<a href={`${base}getting-started/quick-start/`} class="header-link">Quick Start</a>
9+
<a href={`${base}reference/cli/`} class="header-link">CLI</a>
10+
<a href={`${base}guides/ui/`} class="header-link">UI</a>
11+
<a href={`${base}faq/`} class="header-link">FAQ</a>
12+
</nav>
13+
14+
<!-- Hamburger menu for narrow viewports where full nav would overflow -->
15+
<div class="tablet-nav-wrapper">
16+
<button class="hamburger-btn" aria-label="Toggle navigation menu" aria-expanded="false" aria-controls="tablet-nav-dropdown">
17+
<span class="hamburger-icon" aria-hidden="true"></span>
18+
</button>
19+
<nav class="tablet-dropdown" id="tablet-nav-dropdown" aria-label="Primary navigation" hidden>
20+
<a href={`${base}introduction/overview/`} class="dropdown-link">Overview</a>
21+
<a href={`${base}getting-started/quick-start/`} class="dropdown-link">Quick Start</a>
22+
<a href={`${base}reference/cli/`} class="dropdown-link">CLI</a>
23+
<a href={`${base}guides/ui/`} class="dropdown-link">UI</a>
24+
<a href={`${base}faq/`} class="dropdown-link">FAQ</a>
25+
</nav>
26+
</div>
27+
28+
<Default {...Astro.props} />
29+
30+
<style>
31+
.custom-header-links {
32+
display: flex;
33+
align-items: center;
34+
gap: 1rem;
35+
margin-right: 1rem;
36+
}
37+
38+
.header-link {
39+
color: var(--sl-color-text);
40+
text-decoration: none;
41+
font-size: 0.875rem;
42+
font-weight: 500;
43+
padding: 0.25rem 0.75rem;
44+
border-radius: 4px;
45+
transition: color 0.15s ease, background-color 0.15s ease;
46+
white-space: nowrap;
47+
}
48+
49+
.header-link:hover {
50+
color: var(--sl-color-text-accent);
51+
background-color: rgba(110, 118, 129, 0.1);
52+
}
53+
54+
/* Tablet navigation — hidden by default; shown via global CSS at narrow widths */
55+
.tablet-nav-wrapper {
56+
display: none;
57+
position: relative;
58+
margin-right: 0.5rem;
59+
}
60+
61+
.hamburger-btn {
62+
background: none;
63+
border: none;
64+
cursor: pointer;
65+
padding: 0.5rem;
66+
color: var(--sl-color-text);
67+
border-radius: 4px;
68+
min-height: 44px;
69+
min-width: 44px;
70+
display: inline-flex;
71+
align-items: center;
72+
justify-content: center;
73+
}
74+
75+
.hamburger-btn:hover {
76+
background-color: rgba(110, 118, 129, 0.1);
77+
}
78+
79+
.hamburger-icon {
80+
display: block;
81+
width: 20px;
82+
height: 2px;
83+
background: currentColor;
84+
position: relative;
85+
}
86+
87+
.hamburger-icon::before,
88+
.hamburger-icon::after {
89+
content: '';
90+
display: block;
91+
width: 20px;
92+
height: 2px;
93+
background: currentColor;
94+
position: absolute;
95+
left: 0;
96+
}
97+
98+
.hamburger-icon::before { top: -6px; }
99+
.hamburger-icon::after { top: 6px; }
100+
101+
.tablet-dropdown {
102+
position: absolute;
103+
top: calc(100% + 0.5rem);
104+
right: 0;
105+
background: var(--sl-color-bg-nav, #161b22);
106+
border: 1px solid rgba(48, 54, 61, 0.8);
107+
border-radius: 8px;
108+
padding: 0.5rem 0;
109+
min-width: 180px;
110+
z-index: 100;
111+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
112+
}
113+
114+
.dropdown-link {
115+
display: block;
116+
padding: 0.625rem 1rem;
117+
color: var(--sl-color-text);
118+
text-decoration: none;
119+
font-size: 0.875rem;
120+
font-weight: 500;
121+
transition: background-color 0.15s ease;
122+
}
123+
124+
.dropdown-link:hover {
125+
background-color: rgba(110, 118, 129, 0.1);
126+
color: var(--sl-color-text-accent);
127+
}
128+
</style>
129+
130+
<script>
131+
let hamburgerAbort: AbortController | undefined;
132+
133+
function initHamburgerMenu() {
134+
hamburgerAbort?.abort();
135+
hamburgerAbort = new AbortController();
136+
const { signal } = hamburgerAbort;
137+
138+
const hamburgerBtn = document.querySelector<HTMLButtonElement>('.hamburger-btn');
139+
const tabletDropdown = document.querySelector<HTMLElement>('.tablet-dropdown');
140+
141+
if (!hamburgerBtn || !tabletDropdown) return;
142+
143+
hamburgerBtn.addEventListener('click', (e) => {
144+
e.stopPropagation();
145+
const isOpen = hamburgerBtn.getAttribute('aria-expanded') === 'true';
146+
hamburgerBtn.setAttribute('aria-expanded', String(!isOpen));
147+
tabletDropdown.hidden = isOpen;
148+
if (!isOpen) {
149+
const firstLink = tabletDropdown.querySelector<HTMLAnchorElement>('.dropdown-link');
150+
firstLink?.focus();
151+
}
152+
}, { signal });
153+
154+
document.addEventListener('click', (e) => {
155+
if (!hamburgerBtn.contains(e.target as Node) && !tabletDropdown.contains(e.target as Node)) {
156+
hamburgerBtn.setAttribute('aria-expanded', 'false');
157+
tabletDropdown.hidden = true;
158+
}
159+
}, { signal });
160+
161+
document.addEventListener('keydown', (e) => {
162+
if (e.key === 'Escape' && hamburgerBtn.getAttribute('aria-expanded') === 'true') {
163+
hamburgerBtn.setAttribute('aria-expanded', 'false');
164+
tabletDropdown.hidden = true;
165+
hamburgerBtn.focus();
166+
}
167+
}, { signal });
168+
}
169+
170+
initHamburgerMenu();
171+
document.addEventListener('astro:page-load', initHamburgerMenu);
172+
</script>

docs/src/content.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
import { defineCollection } from 'astro:content';
1+
import { defineCollection, z } from 'astro:content';
22
import { docsLoader } from '@astrojs/starlight/loaders';
33
import { docsSchema } from '@astrojs/starlight/schema';
44

55
export const collections = {
66
docs: defineCollection({
77
loader: docsLoader(),
8-
schema: docsSchema(),
8+
schema: docsSchema({
9+
extend: z.object({
10+
banner: z.object({
11+
content: z.string(),
12+
}).default({
13+
content: 'Stacked PRs is currently in private preview. <a href="https://gh.io/stacksbeta">Sign up for the waitlist →</a>',
14+
}),
15+
}),
16+
}),
917
}),
1018
};

0 commit comments

Comments
 (0)