-
Notifications
You must be signed in to change notification settings - Fork 10
docs: Card-based Guides discovery page with category filtering #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rachaelrenk
wants to merge
5
commits into
main
Choose a base branch
from
guides-navigation-card-grid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
db17955
feat: card-based Guides discovery page with category filtering
rachaelrenk e5dc055
fix: resolve TypeScript error in content.config.ts
rachaelrenk 9c385f6
Merge branch 'main' into guides-navigation-card-grid
rachaelrenk 95b8bbd
fix: remove card hover underline, make Featured a filter pill
rachaelrenk 28a41cc
Merge branch 'main' into guides-navigation-card-grid
rachaelrenk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| --- | ||
| // Pure Astro component for the Guides card-based discovery page. | ||
| // Renders the full card grid at build time; a small inline script | ||
| // handles filter-pill interactivity on the client. | ||
| import { getCollection } from 'astro:content'; | ||
|
|
||
| const CATEGORY_LABELS: Record<string, string> = { | ||
| 'getting-started': 'Getting started', | ||
| 'agent-workflows': 'Agent workflows', | ||
| configuration: 'Configuration', | ||
| 'external-tools': 'External tools', | ||
| 'build-an-app-in-warp': 'Build an app', | ||
| devops: 'DevOps', | ||
| frontend: 'Frontend & UI', | ||
| }; | ||
|
|
||
| const allDocs = await getCollection('docs', (entry) => | ||
| entry.id.startsWith('guides/') && entry.id !== 'guides' && !entry.id.endsWith('/index'), | ||
| ); | ||
|
|
||
| interface GuideData { | ||
| title: string; | ||
| description: string; | ||
| href: string; | ||
| category: string; | ||
| categoryLabel: string; | ||
| tags: string[]; | ||
| featured: boolean; | ||
| } | ||
|
|
||
| const guides: GuideData[] = allDocs | ||
| .filter((doc) => { | ||
| const parts = doc.id.replace(/^guides\//, '').split('/'); | ||
| return parts.length >= 2; | ||
| }) | ||
| .map((doc) => { | ||
| const category = doc.id.replace(/^guides\//, '').split('/')[0]; | ||
| return { | ||
| title: (doc.data as any).sidebar?.label || doc.data.title, | ||
| description: doc.data.description || '', | ||
| href: '/' + doc.id.replace(/\.mdx?$/, '') + '/', | ||
| category, | ||
| categoryLabel: CATEGORY_LABELS[category] || category, | ||
| tags: (doc.data as any).tags || [], | ||
| featured: (doc.data as any).featured || false, | ||
| }; | ||
| }); | ||
|
|
||
| const featured = guides.filter((g) => g.featured); | ||
|
|
||
| // Derive ordered categories | ||
| const categories = Object.keys(CATEGORY_LABELS).filter((cat) => | ||
| guides.some((g) => g.category === cat), | ||
| ); | ||
| --- | ||
|
|
||
| <div class="warp-guide-grid-container not-content"> | ||
| {/* Filter pills — Featured is the default; All shows everything flat */} | ||
| <div class="warp-guide-filters" role="tablist" aria-label="Filter guides by category"> | ||
| {featured.length > 0 && ( | ||
| <button | ||
| role="tab" | ||
| aria-selected="true" | ||
| class="warp-guide-filter-pill active" | ||
| data-filter="featured" | ||
| > | ||
| Featured ({featured.length}) | ||
| </button> | ||
| )} | ||
| <button | ||
| role="tab" | ||
| aria-selected="false" | ||
| class="warp-guide-filter-pill" | ||
| data-filter="all" | ||
| > | ||
| All ({guides.length}) | ||
| </button> | ||
| {categories.map((cat) => { | ||
| const count = guides.filter((g) => g.category === cat).length; | ||
| return ( | ||
| <button | ||
| role="tab" | ||
| aria-selected="false" | ||
| class="warp-guide-filter-pill" | ||
| data-filter={cat} | ||
| > | ||
| {CATEGORY_LABELS[cat]} ({count}) | ||
| </button> | ||
| ); | ||
| })} | ||
| </div> | ||
|
|
||
| {/* Single card grid — filtering is handled client-side */} | ||
| <div class="warp-guide-card-grid"> | ||
| {guides.map((guide) => ( | ||
| <a | ||
| href={guide.href} | ||
| class="warp-guide-card" | ||
| data-category={guide.category} | ||
| data-featured={guide.featured ? 'true' : undefined} | ||
| > | ||
| <span class="warp-guide-card-category">{guide.categoryLabel}</span> | ||
| <h3 class="warp-guide-card-title">{guide.title}</h3> | ||
| {guide.description && <p class="warp-guide-card-desc">{guide.description}</p>} | ||
| {guide.tags.length > 0 && ( | ||
| <div class="warp-guide-card-tags"> | ||
| {guide.tags.map((tag) => ( | ||
| <span class="warp-guide-card-tag">{tag}</span> | ||
| ))} | ||
| </div> | ||
| )} | ||
| </a> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| <script is:inline> | ||
| // Client-side filter pill interactivity | ||
| (() => { | ||
| const container = document.querySelector('.warp-guide-grid-container'); | ||
| if (!container) return; | ||
|
|
||
| const pills = container.querySelectorAll('.warp-guide-filter-pill'); | ||
| const cards = container.querySelectorAll('.warp-guide-card'); | ||
|
|
||
| pills.forEach((pill) => { | ||
| pill.addEventListener('click', () => { | ||
| const filter = pill.getAttribute('data-filter'); | ||
|
|
||
| // Update pill states | ||
| pills.forEach((p) => { | ||
| p.classList.remove('active'); | ||
| p.setAttribute('aria-selected', 'false'); | ||
| }); | ||
| pill.classList.add('active'); | ||
| pill.setAttribute('aria-selected', 'true'); | ||
|
|
||
| // Filter cards | ||
| cards.forEach((card) => { | ||
| let show = false; | ||
| if (filter === 'all') { | ||
| show = true; | ||
| } else if (filter === 'featured') { | ||
| show = card.hasAttribute('data-featured'); | ||
| } else { | ||
| show = card.getAttribute('data-category') === filter; | ||
| } | ||
| card.style.display = show ? '' : 'none'; | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| // Apply initial filter (Featured is default) | ||
| const defaultPill = container.querySelector('.warp-guide-filter-pill.active'); | ||
| if (defaultPill) defaultPill.click(); | ||
| })(); | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 [SUGGESTION] These controls are filters, not tabs with associated tab panels; use a grouped button pattern with
aria-pressed, or implement full tab keyboard and panel semantics.