-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
See for where the solution came from DefinitelyTyped/DefinitelyTyped#35572 (comment)
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', |
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.
q: can you remind me why we needed to change these?
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.
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.
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.
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
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.
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; |
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.
might not need the !important
? it renders correctly without it, but maybe there's an edge case i'm not seeing
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.
Got it! Yeah there is a good chance that I just forgot to remove this.
} | ||
|
||
button::before { | ||
color: transparent !important; |
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.
same as above -- the important
for this button and the next don't seem to be necessary
], | ||
} as Meta | ||
|
||
const mockArticles: ArticleListItemRecord[] = [ |
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.
TODO for future: Another opportunity to store/reuse data in __fixtures__/data
src/pages/news-announcements.tsx
Outdated
{articles.length > 0 && ( | ||
<section className={styles.newsCarouselSection}> | ||
<NewsCarousel articles={articles} /> | ||
</section> | ||
)} | ||
|
||
{articles.length > 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.
Question: any reason we couldn't combine these two checks they look the same?
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.
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.
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.
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?
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.
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.
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.
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.
|
||
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 |
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.
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.
## [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)
SC-589
Proposed changes
Reviewer notes
With at least one article published on your local CMS, navigate to
/news-announcements
/news
where all CMS articles are displayedSetup
Make sure to have both the CMS and the portal client running on your local machine. You can do this by
yarn services:up && yarn dev
in the CMS repo andyarn dev
in the portal client with this branch checked outAlso, 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
As code reviewer(s), I have
As a designer reviewer, I have
As a test user, I have