-
Notifications
You must be signed in to change notification settings - Fork 2
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
isom-1727 bug external link all should have new tab icon open in new #1139
isom-1727 bug external link all should have new tab icon open in new #1139
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 290 Passed, 37 Skipped, 55.07s Total Time 🔻 Code Coverage Decreases vs Default Branch (1)
|
}), | ||
} | ||
|
||
// TODO: fix the external link icon showing up when the text is long |
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 understand this comment, what's the current behaviour when the text is long?
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.
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.
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 was hesistating on this too because it's not the most ideal, tho you might be right that it's better-than-nothing. will make the UI change, but still keep the commment to explain the desired outcome!
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.
Ok, cc @sehyunidaaa fyi
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.
realized it's not as simple to apply line-clamp-3
to the text span as that would mean the icon is always on the next line, which isn't ideal when the title is too short and not truncated.
instead, updated it (e1fdb2d, 4cf732c, f0e2e9d) such that
- there's a
useEffect
to check if the text is truncated before deciding the location of the icon - and because it's a useEffect, we will need
use client
so i further split it intoInternalLinkTitle
(rendered during SSG) andexternalLinkTitle
(rendered during client side)
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.
How do I check this on storybook? Tried on this, but still was unable to see the icon
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.
@@ -1,5 +1,4 @@ | |||
import type { Meta, StoryObj } from "@storybook/react" | |||
import { expect, userEvent, within } from "@storybook/test" |
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.
unrelated to this PR - just saw that it's not actually being used
interface GenerateArgsProps { | ||
shouldShowDate?: boolean | ||
isLastUpdatedUndefined?: boolean | ||
withoutImage?: boolean | ||
title?: string | ||
description?: string | ||
tags?: Tag[] | ||
isExternalLink?: boolean | ||
} | ||
|
||
const generateArgs = ({ | ||
shouldShowDate = true, | ||
isLastUpdatedUndefined = false, | ||
withoutImage = false, | ||
title = "A journal on microscopic plastic and their correlation to the number of staycations enjoyed per millennials between the ages of 30-42, substantiated by research from IDK university", | ||
description = "We've looked at how people's spending correlates with how much microscopic plastic they consumed over the year. We've looked at how people's spending correlates with how much microscopic plastic they consumed over the year.", | ||
tags = [], | ||
}: { | ||
isExternalLink = false, | ||
}: GenerateArgsProps): Partial<CollectionCardProps> & { | ||
shouldShowDate?: boolean | ||
isLastUpdatedUndefined?: boolean | ||
withoutImage?: boolean | ||
title?: string | ||
description?: string | ||
tags?: Tag[] | ||
}): Partial<CollectionCardProps> & { shouldShowDate?: 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.
slight refactoring here since props is getting larger
interface GenerateArgsProps { | ||
shouldShowDate?: boolean | ||
isLastUpdatedUndefined?: boolean | ||
withoutImage?: boolean | ||
title?: string | ||
description?: string | ||
tags?: Tag[] | ||
isExternalLink?: boolean | ||
} | ||
const generateArgs = ({ | ||
shouldShowDate = true, | ||
isLastUpdatedUndefined = false, | ||
withoutImage = false, | ||
title = "A journal on microscopic plastic and their correlation to the number of staycations enjoyed per millennials between the ages of 30-42, substantiated by research from IDK university", | ||
description = "We've looked at how people's spending correlates with how much microscopic plastic they consumed over the year. We've looked at how people's spending correlates with how much microscopic plastic they consumed over the year.", | ||
tags = [], | ||
}: { | ||
isExternalLink = false, | ||
}: GenerateArgsProps): Partial<CollectionCardProps> & { | ||
shouldShowDate?: boolean | ||
isLastUpdatedUndefined?: boolean | ||
withoutImage?: boolean | ||
title?: string | ||
description?: string | ||
tags?: Tag[] | ||
}): Partial<CollectionCardProps> & { shouldShowDate?: 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.
slight refactoring here since props is getting larger
Problem
For buttons and collection/blog cards, external links 1) do not open in new tab and 2) show "new tab" icon at the end
Closes https://linear.app/ogp/issue/ISOM-1727/bug-external-link-all-should-have-new-tab-icon-open-in-new-tab
Solution
Breaking Changes
Bug Fixes:
LinkButton
CollectionCard
andBlogCard
+ add storiesTests
https://google.com
.target: _blank
https://google.com
.target: _blank