Skip to content
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: Add internal news carousel for news and announcements page #744

Merged
merged 30 commits into from
Aug 23, 2022

Conversation

jcbcapps
Copy link
Contributor

@jcbcapps jcbcapps commented Aug 16, 2022

SC-589

Proposed changes

  • Adds a carousel that features the four latest articles from the CMS on the news and announcements page

Reviewer notes

With at least one article published on your local CMS, navigate to /news-announcements

  • Verify that the carousel is at the top of the page, and shows the title and preview test of your article, along with a default CTA with the text "View Full Announcement" and a placeholder image
  • Verify that there is a button beneath the carousel with the text "View older Internal USSF news" and clicking that button takes you to /news where all CMS articles are displayed
  • Verify that clicking the CTA opens the article in another tab

Setup

Make sure to have both the CMS and the portal client running on your local machine. You can do this by

  • Running yarn services:up && yarn dev in the CMS repo and
  • Running yarn dev in the portal client with this branch checked out

Also, make sure that you have some published articles in your local CMS that have the category InternalNews


Code review steps

As the original developer, I have

  • Met the acceptance criteria, or will meet them in subsequent PRs or stories
  • Created new stories in Storybook if applicable
    • Checked that all Storybook accessibility checks are passing
  • Created/modified automated unit tests in Jest
    • Including jest-axe checks when UI changes
  • Created/modified automated E2E tests in Cypress
    • Including cypress-axe checks when UI changes
  • Performed a11y testing:
    • Checked responsiveness in mobile, tablet, and desktop
    • Checked keyboard navigability
    • Tested with VoiceOver in Safari
    • Checked VO's rotor menu for landmarks, page heading structure and links
    • Used a browser a11y tool to check for issues (WAVE, axe, ANDI or Accessibility addon tab for Storybook)
  • Requested a design review for user-facing changes
  • For any new migrations/schema changes:
    • Followed guidelines for zero-downtime deploys

As code reviewer(s), I have

  • Pulled this branch locally and tested it
  • Reviewed this code and left comments
  • Checked that all code is adequately covered by tests
  • Made it clear which comments need to be addressed before this work is merged
  • Considered marking this as accepted even if there are small changes needed
  • Performed a11y testing:
    • Checked responsiveness in mobile, tablet, and desktop
    • Checked keyboard navigability
    • Tested with VoiceOver in Safari
    • Checked VO's rotor menu for landmarks, page heading structure and links
    • Used a browser a11y tool to check for issues (WAVE, axe, ANDI or Accessibility addon tab for Storybook)

As a designer reviewer, I have

  • Checked in the design translated visually
  • Checked behavior
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links
  • Tried to break the intended flow
  • Performed a11y testing:
    • Checked responsiveness in mobile, tablet, and desktop
    • Checked keyboard navigability
    • Tested with VoiceOver in Safari
    • Checked VO's rotor menu for landmarks, page heading structure and links
    • Used a browser a11y tool to check for issues (WAVE, axe, ANDI or Accessibility addon tab for Storybook)

As a test user, I have

  • Run through the Test Script:
    • On commercial internet in IE11
    • On commercial internet in Firefox
    • On commercial internet in Chrome
    • On commercial internet in Safari
    • On NIPR in IE11
    • On NIPR in Firefox
    • On NIPR in Chrome
    • On NIPR in Safari
    • On a mobile device in Firefox
    • On a mobile device in Chrome
    • On a mobile device in Safari
  • Added any anomalous behavior to this PR

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #589: Add an internal news carousel to News & Announcements page.

@@ -1,38 +1,42 @@
export const cmsPortalNewsArticlesMock = [
{
__typename: 'Article',
id: 'cl3buldda0247riyt6h85cpgc',
id: 'id1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: can you remind me why we needed to change these?

Copy link
Contributor Author

@jcbcapps jcbcapps Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it was just something I thought would be helpful. I've noticed in other mock data in the repo, we're using just basic ids (ex: 1, test1) so I just thought I'd make it less complicated. I copy/pasted the data from a query I did against my local cms, and I just thought all that long text is a pain to look at. Just thinking ahead to if anyone ever needs to differentiate between items in the array via the id or something it would just be quicker/easier to look at.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha -- i think overall we can definitely improve our mock data and should align on some styles, like what should be as close to the format of prod data (the previous id) and what can be simplified (the current id). for a future eng sync, maybe! cc @gidjin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligning on some standards of when to pick a production format vs not. I could go either way here so probably worth us talking it out a little bit or just agreeing to one. Would / Could the library you were looking at for seed data help in this situation as well?

@import 'styles/sfds/sfdsDependencies';

.carouselContainer {
display: flex !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might not need the !important? it renders correctly without it, but maybe there's an edge case i'm not seeing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Yeah there is a good chance that I just forgot to remove this.

}

button::before {
color: transparent !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above -- the important for this button and the next don't seem to be necessary

],
} as Meta

const mockArticles: ArticleListItemRecord[] = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO for future: Another opportunity to store/reuse data in __fixtures__/data

src/components/NewsCarousel/NewsCarousel.test.tsx Outdated Show resolved Hide resolved
src/components/NewsCarouselItem/NewsCarouselItem.tsx Outdated Show resolved Hide resolved
Comment on lines 52 to 58
{articles.length > 0 && (
<section className={styles.newsCarouselSection}>
<NewsCarousel articles={articles} />
</section>
)}

{articles.length > 0 && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: any reason we couldn't combine these two checks they look the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how I initially had it, but had to separate them because react-slick is using some styles (I think the position absolute) on the dots that was preventing me from getting any padding or margin between the two. I'm sure there is a work around we could do in CSS, but couldn't figure it out so thought this would be a passable solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Might be worth a short comment to note that since it's not obvious from the code that was needed. Or maybe placing a <span/> in between them would solve it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't think about using a <span />. I'll give that a try and if it doesn't work, I'll add in a comment.

@jcbcapps jcbcapps requested a review from minhlai as a code owner August 18, 2022 14:24
Copy link
Contributor

@gidjin gidjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good, things work. I noticed something odd the styling of the carousel looks funny, (the image is too small and the layout is squished) if there is no preview filled in. Should we do something about that? Feels like preview would always be included but we don't mark it required so I'm not sure which way we should handle it. I think answering that can be part of a follow up story, so I'm approving.

Screen Shot 2022-08-22 at 15 19 26


fireEvent.click(screen.getByTestId('slick-prev'))
expect(screen.getAllByText('Announcing the dev blog')).toHaveLength(2)
// TODO: verify that this actually changes the current slide in the carousel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: I'm sad this todo doesn't reflect the valiant effort to make it happen. So the praise is for that valiant effort and being willing to set it aside for now.

@jcbcapps jcbcapps merged commit c4acfe6 into main Aug 23, 2022
@jcbcapps jcbcapps deleted the sc-589/internal-news-carousel branch August 23, 2022 19:12
@gidjin gidjin mentioned this pull request Aug 24, 2022
gidjin added a commit that referenced this pull request Aug 24, 2022
## [4.7.0](4.6.0...4.7.0) (2022-08-24)


### Features

* Add internal news carousel for news and announcements page ([#744](#744)) ([c4acfe6](c4acfe6)), closes [/github.com/DefinitelyTyped/DefinitelyTyped/issues/35572#issuecomment-498242139](https://github.com/USSF-ORBIT//github.com/DefinitelyTyped/DefinitelyTyped/issues/35572/issues/issuecomment-498242139)
* Display Spaceforce.mil news articles below the news carousel ([#746](#746)) ([e13b57a](e13b57a)), closes [/github.com/DefinitelyTyped/DefinitelyTyped/issues/35572#issuecomment-498242139](https://github.com/USSF-ORBIT//github.com/DefinitelyTyped/DefinitelyTyped/issues/35572/issues/issuecomment-498242139)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants