links-fe: correct padding

Fixes urbit/landscape#364
This commit is contained in:
Liam Fitzgerald 2021-02-09 08:07:23 +10:00
parent 1a6c3a1767
commit 26847c40cb
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
2 changed files with 23 additions and 10 deletions

View File

@ -107,7 +107,7 @@ export function LinkResource(props: LinkResourceProps) {
return (
<Col alignItems="center" overflowY="auto" width="100%">
<Col width="100%" p={3} maxWidth="768px">
<Link to={resourceUrl}><Text bold>{"<- Back"}</Text></Link>
<Link to={resourceUrl}><Text px={3} bold>{"<- Back"}</Text></Link>
<LinkItem
contacts={contacts}
key={node.post.index}
@ -134,6 +134,7 @@ export function LinkResource(props: LinkResourceProps) {
history={props.history}
baseUrl={`${resourceUrl}/${props.match.params.index}`}
group={group}
px={3}
/>
</Col>
</Col>

View File

@ -11,6 +11,7 @@ import { createPost, createBlankNodeWithChildPost } from '~/logic/api/graph';
import { getLatestCommentRevision } from '~/logic/lib/publish';
import tokenizeMessage from '~/logic/lib/tokenizeMessage';
import { getUnreadCount } from '~/logic/lib/hark';
import {PropFunc} from '~/types/util';
interface CommentsProps {
comments: GraphNode;
@ -24,8 +25,19 @@ interface CommentsProps {
group: Group;
}
export function Comments(props: CommentsProps) {
const { association, comments, ship, name, api, history, baseUrl, group } = props;
export function Comments(props: CommentsProps & PropFunc<typeof Col>) {
const {
association,
comments,
ship,
name,
editCommentId,
api,
history,
baseUrl,
group,
...rest
} = props;
const onSubmit = async (
{ comment },
@ -52,7 +64,7 @@ export function Comments(props: CommentsProps) {
actions: FormikHelpers<{ comment: string }>
) => {
try {
const commentNode = comments.children.get(bigInt(props.editCommentId))!;
const commentNode = comments.children.get(bigInt(editCommentId))!;
const [idx, _] = getLatestCommentRevision(commentNode);
const content = tokenizeMessage(comment);
@ -70,8 +82,8 @@ export function Comments(props: CommentsProps) {
};
let commentContent = null;
if (props.editCommentId) {
const commentNode = comments.children.get(bigInt(props.editCommentId));
if (editCommentId) {
const commentNode = comments.children.get(bigInt(editCommentId));
const [_, post] = getLatestCommentRevision(commentNode);
commentContent = post.contents.reduce((val, curr) => {
if ('text' in curr) {
@ -102,9 +114,9 @@ export function Comments(props: CommentsProps) {
const readCount = children.length - getUnreadCount(props?.unreads, association['app-path'], parentIndex)
return (
<Col>
{( !props.editCommentId ? <CommentInput onSubmit={onSubmit} /> : null )}
{( !!props.editCommentId ? (
<Col {...rest}>
{( !editCommentId ? <CommentInput onSubmit={onSubmit} /> : null )}
{( !!editCommentId ? (
<CommentInput
onSubmit={onEdit}
label='Edit Comment'
@ -125,7 +137,7 @@ export function Comments(props: CommentsProps) {
unread={i >= readCount}
baseUrl={props.baseUrl}
group={group}
pending={idx.toString() === props.editCommentId}
pending={idx.toString() === editCommentId}
/>
);
})}