|
| 1 | +--- |
| 2 | +interface Recipe { |
| 3 | + slug: string; |
| 4 | + title: string; |
| 5 | +} |
| 6 | +
|
| 7 | +interface Props { |
| 8 | + currentSection: string; |
| 9 | +} |
| 10 | +
|
| 11 | +const { currentSection } = Astro.props; |
| 12 | +const base = import.meta.env.BASE_URL; |
| 13 | +
|
| 14 | +const groups: { label: string; recipes: Recipe[] }[] = [ |
| 15 | + { |
| 16 | + label: "Everyday", |
| 17 | + recipes: [ |
| 18 | + { slug: "playbook/undoing-changes", title: "Undoing Changes" }, |
| 19 | + { slug: "playbook/diffing", title: "Diffing" }, |
| 20 | + { slug: "playbook/history", title: "History" }, |
| 21 | + { slug: "playbook/stashing", title: "Stashing" }, |
| 22 | + ], |
| 23 | + }, |
| 24 | + { |
| 25 | + label: "Branching and Merging", |
| 26 | + recipes: [ |
| 27 | + { slug: "playbook/branching", title: "Branching" }, |
| 28 | + { slug: "playbook/merging", title: "Merging" }, |
| 29 | + { slug: "playbook/rebasing", title: "Rebasing" }, |
| 30 | + { slug: "playbook/cherry-picking", title: "Cherry-Picking" }, |
| 31 | + ], |
| 32 | + }, |
| 33 | + { |
| 34 | + label: "Remote", |
| 35 | + recipes: [ |
| 36 | + { slug: "playbook/remote-operations", title: "Remote Operations" }, |
| 37 | + { slug: "playbook/remote-management", title: "Remote Management" }, |
| 38 | + ], |
| 39 | + }, |
| 40 | + { |
| 41 | + label: "Project Structure", |
| 42 | + recipes: [ |
| 43 | + { slug: "playbook/tagging", title: "Tagging" }, |
| 44 | + { slug: "playbook/submodules", title: "Submodules" }, |
| 45 | + { slug: "playbook/subtrees", title: "Subtrees" }, |
| 46 | + ], |
| 47 | + }, |
| 48 | + { |
| 49 | + label: "Advanced", |
| 50 | + recipes: [ |
| 51 | + { slug: "playbook/selectors", title: "Selectors" }, |
| 52 | + { slug: "playbook/hooks", title: "Hooks" }, |
| 53 | + { slug: "playbook/debugging", title: "Debugging" }, |
| 54 | + { slug: "playbook/configuration", title: "Configuration" }, |
| 55 | + ], |
| 56 | + }, |
| 57 | +]; |
| 58 | +--- |
| 59 | + |
| 60 | +<nav class="playbook-nav"> |
| 61 | + <div class="playbook-nav-title"> |
| 62 | + <a href={`${base}playbook/`} class={currentSection === "playbook" ? "active" : ""}>Playbook</a> |
| 63 | + </div> |
| 64 | + {groups.map((group) => ( |
| 65 | + <div class="playbook-nav-group"> |
| 66 | + <div class="playbook-nav-group-label">{group.label}</div> |
| 67 | + <ul> |
| 68 | + {group.recipes.map((r) => ( |
| 69 | + <li> |
| 70 | + <a |
| 71 | + href={`${base}${r.slug}/`} |
| 72 | + class={currentSection === r.slug ? "active" : ""} |
| 73 | + > |
| 74 | + {r.title} |
| 75 | + </a> |
| 76 | + </li> |
| 77 | + ))} |
| 78 | + </ul> |
| 79 | + </div> |
| 80 | + ))} |
| 81 | +</nav> |
0 commit comments