fix: improvements in editor exprience#2892
Conversation
| @@ -23,14 +23,20 @@ const collapseWhitespace = (text: string): string => { | |||
| const linkifyText = (text: string): string => { | |||
| if (!text) return "" | |||
| console.log("Linkifying text:", text) | |||
There was a problem hiding this comment.
Can we remove the console.log
| <MainStoryCard> | ||
| <MainStoryImage> | ||
| {item.image?.url && ( | ||
| {item.image?.url && !imageError && ( |
There was a problem hiding this comment.
Perhaps use a placeholder here, if the image errors.
There was a problem hiding this comment.
It automatically shows the placeholder when we get error
| const ArticleBannerStyled = styled(ArticleBanner)<{ $page: number }>` | ||
| padding: 48px 0; | ||
| padding-bottom: 250px; | ||
| ${({ $page }) => $page === 1 && "padding-bottom: 250px;"} |
There was a problem hiding this comment.
We don't tend to use $ prefixes for variable names and props in the codebase. Note that the $ prefix to mark a prop as transient is a styled-components thing, but Emotion does not support.
| padding: 48px 0; | ||
| padding-bottom: 250px; | ||
| ${({ $page }) => $page === 1 && "padding-bottom: 250px;"} | ||
| position: relative; |
There was a problem hiding this comment.
Note that we object styles are preferred over template literals for type safety, ease of refactoring etc, also there was a plan to migrate to styled() or Pigment CSS for zero runtime / performance, which may resurface, see https://github.com/mitodl/hq/issues/6636.
There was a problem hiding this comment.
e.g. L435 cleaner with
paddingBottom: page === 1 ? "250px" : undefined,
| @@ -497,6 +499,8 @@ const MainStory: React.FC<{ item: NewsFeedItem }> = ({ item }) => { | |||
|
|
|||
| // Regular Story Component for grid | |||
There was a problem hiding this comment.
Let's add comments only if the code does not self describe.
| @@ -23,14 +23,20 @@ const collapseWhitespace = (text: string): string => { | |||
| const linkifyText = (text: string): string => { | |||
There was a problem hiding this comment.
Do we still need linkifyText() if links are now produced on the backend?
There was a problem hiding this comment.
Yes it is still needed because if user directly paste the url in summary then it would have to add achor tag in summary text.
fd562ef to
1b46422
Compare
What are the relevant tickets?
Description (What does it do?)
Following Improvements we have done in this PR
Screenshots (if appropriate):
How can this be tested?
2 - On page 2, 3 and so on you should not see the extra bottom padding in banner image.
3 - If you add the url to text by using the editor control or even paste the direct url in the sub-heading sectionwhile creating or updating the article then it should be properly render inside the listing page summary section of each News
Additional Context