-
Notifications
You must be signed in to change notification settings - Fork 42
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
Markdown-driven static pages: building the framework #5601
Conversation
This pull request introduces 1 alert when merging 05b017c into 64a1601 - view on LGTM.com new alerts:
|
# Conflicts: # frontend-react/src/components/header/AdminDropdownNav.tsx
@@ -63,6 +67,11 @@ | |||
"yarn:show-outdated-packages": "yarn outdated", | |||
"run-build-dir": "yarn build:localdev:csp && yarn global add serve && serve -s build" | |||
}, | |||
"jest": { | |||
"transformIgnorePatterns": [ |
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.
Big ugly line of config to get jest and react-markdown to play nice
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.
ouch! wonder if there's any way to point to this thread for further explanation remarkjs/react-markdown#635 (comment)
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.
looks very cool on my first pass! just a few nits here and there. I'm not sure how to test manually, maybe we can run through that tomorrow
@@ -63,6 +67,11 @@ | |||
"yarn:show-outdated-packages": "yarn outdated", | |||
"run-build-dir": "yarn build:localdev:csp && yarn global add serve && serve -s build" | |||
}, | |||
"jest": { | |||
"transformIgnorePatterns": [ |
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.
ouch! wonder if there's any way to point to this thread for further explanation remarkjs/react-markdown#635 (comment)
@@ -0,0 +1,22 @@ | |||
/* Used to instantiate a set of static pages, like BuiltForYouIndex |
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.
this looks more like a utility class than a component. Maybe it belongs in a utils file somewhere?
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.
I'm on a mission to refactor out the utils files. They tend to become a junk drawer for relatively similar functions a lot of times. That said, I do think it should be either wrapped into a component file or put elsewhere. I think this could easily be merged into the StaticPageFromDirectories
code since these are the directories it uses to generate the content. Makes sense to me as a module.
frontend-react/src/components/Markdown/StaticPageFromDirectories.tsx
Outdated
Show resolved
Hide resolved
frontend-react/src/content/internal-user-guides/make-markdown-pages.md
Outdated
Show resolved
Hide resolved
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.
✅ ✅ ✅ ✅ ✅ ✅ ✅
on the question of where the MarkdownDirectory class should live, I'd still like to see it live somewhere other than Components, since I'd expect everything in there to be renderable as a react component, but that's a personal nit, so this looks good to me to go out as is.
Kudos, SonarCloud Quality Gate passed! |
This PR adds the framework in to create static pages from Markdown files. This is exemplified by adding in a Built For You example and the Admin > Guides page. Both of these pages are generated by the new framework.
Test Steps:
built-for-you
to your feature flags by navigating to Admin > Feature FlagsBuilt For You
. This means it's successfully hidden behind that feature flag and no end user will see it.Changes
MarkdownDirectory
is an object holding markdown files.StaticPageFromDirectories
is a component that takes an array of directories and generates static pages from the markdown content. This also generates side navigation.DropdownNav
is a generative way of adding dropdown navigation items to our header./built-for-you
route/admin/guides
routecreating-markdown-pages
internal user guideChecklist
Testing
./prime test
or./gradlew testSmoke
against local Docker ReportStream container?npm run lint:write
?Process
Linked Issues
Specific Security-related subjects a reviewer should pay specific attention to
If you answered 'yes' to any of the questions above, conduct a detailed Review that addresses at least:
Pull reviewers stats
Stats for the last 30 days: