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
new plugin YoutubeDescription #2427
base: dev
Are you sure you want to change the base?
Conversation
LGTM |
I would personally prefer having it unexpanded by default, showing the first line, and then being able to click to show the rest. |
W |
@Cynosphere added |
return !isNonNullish(embed.rawDescription) | ||
? null | ||
: embed.rawDescription.length > 20 | ||
? <div |
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 nested ternary isn't too great.. it'd be way nicer for readability to convert it into simple if statements, like
if (!embed.rawDescription)
return null;
if (embed.rawDescription.length <= 20)
return original();
return (
<div>
....
} | ||
} | ||
], | ||
ToggleableDescription({ embed, original }: ToggleableDescriptionProps) { |
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 should be wrapped in an ErrorBoundary, then you also wouldn't need your Wrapper function
ToggleableDescription({ embed, original }: ToggleableDescriptionProps) { | |
ToggleableDescription: ErrorBoundary.wrap(({ embed, original }: ToggleableDescriptionProps) => { |
ToggleableDescription({ embed, original }: ToggleableDescriptionProps) { | ||
const [isOpen, setOpen] = useState(false); | ||
|
||
console.warn(embed); |
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.
please remove this console.log
console.warn(embed); |
maybe an improvement to the collapsing could be to collapse on the first newline instead of just after some characters? with a sanity limit of like 200 characters or something |
Adds descriptions to youtube video embeds