-
Notifications
You must be signed in to change notification settings - Fork 6
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
Port blog page to ts #2676
Port blog page to ts #2676
Conversation
are there specific files you'd like eyes on? because this is pretty tricky to follow. in the future you can use |
013cfc5
to
49e8101
Compare
@@ -5,6 +5,7 @@ | |||
background-color: ui-color(white); | |||
justify-items: center; | |||
width: 100%; | |||
overflow: clip; |
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 fixes a layout bug I noticed in the blog article: there is a sticky item that shows how much time is left in the article. It was not being sticky.
@@ -41,8 +42,11 @@ export default function ToggleControlBar({ Indicator, children }) { | |||
onClick={() => toggle()} | |||
onKeyDown={onKeyDown} | |||
ref={focusRef} | |||
role="combobox" | |||
aria-controls={listboxId} |
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 was an accessibility fix needed because the testing library identifies accessible objects and this wasn't one.
@bethshook I have retrofitted file moves into the git history. The "Files changed" tab still shows them as delete and add (because the diffs are not minor enough to show as simply modified -- I moved some code blocks), but if you look in the individual commits after the "mv" or "rename" commits, you can see the file diffs. I think there are four such files: Additionally, blog-pages.tsx was extracted from blog.js (which needed to be js due to dynamic import). Many test files are simply new. I'm sorry it's such a big PR. Changes are generally these types:
I'll make some comments in the code to explain things that I think might be confusing, and of course if you have questions about stuff, you can comment there. |
name?: string; | ||
value: {collection: Collection}[]; | ||
}; | ||
type CollectionVariant = |
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.
These types were simply wrong. They shouldn't have been recursive, they just have an optional wrapping layer.
|
||
type BlurbData = 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.
BlurbData and ArticleSummaryData were defined independently, but BlurbData is really an extension of ArticleSummaryData.
@@ -0,0 +1,267 @@ | |||
import BodyUnit from '~/components/body-units/body-units'; |
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.
Review as diffs here. Or maybe don't. The rearrangement of blocks is hard to follow because the order is basically reversed.
There are no functional changes. It's all about adding types.
@@ -0,0 +1,51 @@ | |||
import React from 'react'; |
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.
You can review as differences here. The big-block changes are just reformatting. Other than that, types.
@@ -0,0 +1,212 @@ | |||
import React from 'react'; |
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.
View as diffs here. For this one, it's just a bunch of types added. A big block of them at the top, and others peppered throughout.
@@ -0,0 +1,106 @@ | |||
import React, {useEffect} from 'react'; |
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.
These routines were extracted from blog.js (the next file down). Types were added. If you had the two files in separate windows, it would be easy to see.
@@ -0,0 +1,33 @@ | |||
import {useState, useEffect} from 'react'; |
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.
As diffs here. The data.subheading change was due to subheading being a required field. Making the variable was just part of the figuring-it-out process; I should probably take that back out.
@@ -0,0 +1,186 @@ | |||
// Blog article data as returned by usePageData |
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.
These next three are just test-data files.
The article progress indicator is supposed to be sticky. The positioning got broken by some overflow on the page.
49e8101
to
3deed37
Compare
type BodyData = { | ||
type: string; | ||
value: | ||
| string |
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.
stray |
?
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 is a weird choice of prettier
. 🤷
|
||
jest.mock('~/pages/blog/pinned-article/pinned-article', () => jest.fn()); | ||
jest.mock('~/pages/blog/more-stories/more-stories', () => ({ | ||
LatestBlurbs: jest.fn() | ||
})); | ||
jest.mock('~/pages/blog/search-results/use-all-articles', () => jest.fn()); | ||
// jest.mock('~/pages/blog/search-results/use-all-articles', () => jest.fn()); |
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.
remove?
function useSubjectSnippetForTopic(topic?: string) { | ||
const {subjectSnippet} = useBlogContext(); | ||
|
||
console.info('***', {subjectSnippet, topic}); |
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.
for dev?
|
||
function SubjectSelector() { | ||
const data = useDataFromSlug('snippets/subjects?locale=en'); | ||
const {subjectSnippet: data} = useBlogContext(); | ||
// const data = useDataFromSlug('snippets/subjects?locale=en'); |
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.
remove?
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 fine to me - just noted a few lines that look like they were added for dev purposes
CORE-539