-
-
Notifications
You must be signed in to change notification settings - Fork 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
+Add support for multiple sections #48
base: main
Are you sure you want to change the base?
Conversation
including documentation update Fix konstantinmuenster#21
bd66e20
to
9b7af82
Compare
including documentation update Fix konstantinmuenster#21
including documentation update Fix konstantinmuenster#21
including documentation update Fix konstantinmuenster#21
including documentation update Fix konstantinmuenster#21
9b7af82
to
52eb293
Compare
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.
Thanks a lot @diiigle – really appreciated! I left a comment. Would be great if we can improve this before merging 👍
const allFiles = response.allFile.aboutFiles; | ||
const fileNameNeedle = props.fileName ? props.fileName : 'about'; | ||
const result = allFiles.find((file) => { | ||
return file.name == fileNameNeedle; | ||
}); | ||
const section = result ? result.section[0] : allFiles[0].section[0]; |
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.
Would be great if we could abstract this away + add null checking and error messages for unknown sections. For example, for the Legal sections, we did:
const data = getSectionBySectionId(response, props.sectionId);
and handled the data part entirely in Legal/data.tsx
.
Fix for #21
Started with
Projects
and will port the same mechanism to the other sections as well. But feel free to give some feedback already, especially on the typescript best practices (got virtually 0 experience there)!Summary
It queries for
File
nodes instead of specific*Json
nodes now, and filters inside the component. Not ideal (the filtering could happen in graphql already), but that its the only way possible with staticQueries (and without variables).Updated the documentation to the best of my knowledge. The example content could be a lot more creative.
Progress
Legalalready contains a filtering mechanism