-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Dynamic landing pages #1143
Conversation
This pull request has been linked to Shortcut Story #2617: Add Landing Page to Portal. |
…/ussf-portal-client into sc-2617/dynamic-landing-pages
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const pageContent = (): any => { |
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.
The content prop for the InPageNavigation
component expects a type of Element & string
for some reason that I don't understand. I tried to remedy this a few other ways, but nothing else worked so I added this any
and explicitly ignored the type.
{articles.length >= 1 && ( | ||
<ArticleList articles={articles} landingPage={true} /> | ||
)} |
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.
Unfortunately, I had to do a bit of prop drilling here. The landingPage
prop gets passed down to ArticleListItem
and is used to link to the dynamic path for an article that is related to a landing page. I did this to save a bit of time on what would probably need to be a larger refactor. Let me know if you see a better solution!
searchQuery?: string | ||
searchDisplay?: boolean |
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 prop wasn't being used, so I changed it to be a boolean that we can use to toggle the display of the Search
component
{ path: '/', label: 'Service portal home' }, | ||
{ path: '/landing', label: 'Landing pages' }, | ||
{ | ||
path: `/landing/${breadcrumbNavItems[2]}`, | ||
label: `${breadcrumbNavItems[2].toUpperCase()}`, | ||
}, | ||
{ | ||
path: `/landing/${breadcrumbNavItems[2]}/${breadcrumbNavItems[3]}`, | ||
label: `${breadcrumbNavItems[3]}`, | ||
current: true, |
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 thought it would be fine to hardcode the array positions here for now, but we could write some logic to make it a bit more dynamic in the future if need be.
@@ -18,6 +18,7 @@ const LandingPageArticle = ({ | |||
return ( | |||
<> | |||
<PageHeader searchDisplay={false}> | |||
<h1>{breadcrumbNavItems[2].toUpperCase()}</h1> |
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 wasn't sure about adding this h1 here, but I thought displaying what landing page the article is nested under could be beneficial.
{category === 'InternalNews' ? ( | ||
<Category category={CONTENT_CATEGORIES.NEWS} /> | ||
) : ( | ||
) : category !== 'LandingPage' ? ( | ||
<Tag className={`${tagStyles.Category}`}>{category}</Tag> | ||
)} | ||
) : null} |
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.
When looking at an article nested under a landing page, the LandingPage
category was being shown. I thought that might be confusing for the user so I added this to hide it.
@jcbcapps to do: add page titles to all pages involved in this. We want to set it to the name of the landing page, not the default of ![]() |
…n and dynamically resizing based on element heights using refs
…nto sc-2617/dynamic-landing-pages
…oves active styles from in page nav as it is flashing the active state in weird ways
…nto sc-2617/dynamic-landing-pages # Conflicts: # src/layout/DefaultLayout/LandingPageLayout.module.scss # src/pages/landing/[landingPage]/index.tsx
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.
shauna and anna approval attained in design <> eng sync today
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.
LGTM!
const session = await getSession(context.req, context.res) | ||
const user = session?.passport?.user | ||
|
||
if (!user) { | ||
return { | ||
redirect: { | ||
destination: '/login', | ||
permanent: false, | ||
}, | ||
} | ||
} |
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.
Question: Did we need to do a redirect here? Asking since I don't know that we do it elsewhere.
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.
Good catch, I don't think we do. I'm currently working on adding tests on another branch and I can remove this there.
SC-2617
Proposed changes
Reviewer notes
E2E tests: https://github.com/USSF-ORBIT/ussf-portal/pull/332
Setup
Start the system
yarn services:up yarn dev cd ../ussf-portal-cms yarn dev
Login to the portal http://localhost:3000
Start storybook
Login to storybook http://localhost:6006, though the command above should open it for you
Code review steps
As the original developer, I have
As a reviewer, I have
Check out our How to review a pull request document.
Screenshots