-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improved rendering of deeply nested comments on narrow screens
- Loading branch information
Showing
5 changed files
with
79 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ArrowRightIcon } from "@heroicons/react/16/solid"; | ||
import { MouseEvent } from "react"; | ||
|
||
export const ShowMoreCommentsLink = (props: { | ||
readonly rootId: number; | ||
onClick?(): Promise<void>; | ||
}) => { | ||
let onClick = undefined; | ||
|
||
if (props.onClick) { | ||
onClick = (e: MouseEvent<HTMLAnchorElement>) => { | ||
e.preventDefault(); | ||
e.nativeEvent.stopImmediatePropagation(); | ||
props.onClick!(); | ||
}; | ||
} | ||
|
||
return ( | ||
<a | ||
className={`ml-10 mt-2 flex cursor-pointer items-center text-xs text-primary-400 | ||
hover:text-primary-300`} | ||
href={`/comment/${props.rootId}`} // If we don't have an onClick function (it was not passed or JS is disabled), we can just navigate to the comment page | ||
onClick={onClick} | ||
> | ||
{"Show more comments "} | ||
<ArrowRightIcon className={"ml-2 h-4"} /> | ||
</a> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters