-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: restore gsoc dropdown on program pages #7431
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
1a8b645
74b1896
85f7b32
a228a3a
32fe9d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,11 +23,15 @@ export const query = graphql`query ProgramByName($program: String!) { | |
| } | ||
| }`; | ||
|
|
||
| const ProgramsPage = ({ data, children }) => { | ||
| const [activeOption] = useState(0); | ||
| const ProgramsPage = ({ data, children, pageContext }) => { | ||
| const programs = data.allMdx.nodes; | ||
| const { navigate } = require("gatsby"); | ||
|
|
||
| const [activeOption] = useState(() => { | ||
| const initialIndex = programs.findIndex((program) => program.fields.slug === pageContext.slug); | ||
| return initialIndex !== -1 ? initialIndex : 0; | ||
| }); | ||
|
|
||
|
Comment on lines
26
to
34
|
||
| const options = programs.map((program) => { | ||
| let optionItem = new Object(); | ||
| optionItem.label = program.frontmatter.title; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.