Skip to content

Conversation

@ssynowiec
Copy link
Contributor

@ssynowiec ssynowiec commented Mar 9, 2023

image
image

Copy link

@Eghizio Eghizio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Left some comments out of curiosity and some of my personal thoughts 😉
This was my first experience with this project so excuse some of my questions 😄
Also, great job on the docs in the README about setting up the project. It helped a lot 💪

<div className="flex-1 px-2 ml-2 text-sm font-medium leading-loose text-gray-600">
{comment}
</div>
<button className="inline-flex items-center px-1 pt-2 ml-1 flex-column">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 2 Reply and Like buttons share styles. Same with the div inside. I'd make a component out of this.
The only difference is the pt-2 which can be applied on some container or spacer.


type ProtectedComponentProps = {
info?: string;
children: ReactNode;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe adding an optional slot for a component that should be displayed in case user is not logged in?

</div>
</section>
<section>
<Tabs />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like DiscussionTabs or make it some discussion section?

author: string;
avatar: string;
comment: string;
date: number;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it UTC timestamp? Are you thinking about specific users from specific timezone? (target)

</button>
<button className="inline-flex items-center px-1 -ml-1 flex-column">
<div className="w-5 h-5">
<Liked />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This buttons with icons are a good candidate for a separate component as well ;)

comment,
date,
timestamp,
}: CommentItemProps) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make a comment: Comment prop accepting an object. No need for spreading then and you have everything contained in one object

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make a comment: Comment prop accepting an object. No need for spreading then and you have everything contained in one object

Sure, but you neeed to destructure it later or write redundant object prop calls

comment.timestamp
comment.avatar
...and so on

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have a param destructurization than something like that tbh.
As for now the CommentItemProps is redundant as the props could be directly typed as Comment.
I used to spread props but over the time I learned in most of the cases it is better to explicitly pass props. There are some exceptions ofc (for example register function for form libs)

Copy link

@Eghizio Eghizio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are getting somewhere 😉

Comment on lines +10 to +14
const sizes = {
24: 'w-24 h-24',
12: 'w-12 h-12',
10: 'w-10 h-10',
};
Copy link

@goodideagiver goodideagiver Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be placed outside of the component (above component declaration) as a const

SIZES or AVATAR_SIZES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants