-
Notifications
You must be signed in to change notification settings - Fork 10
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
Challenge tabs #90
base: main
Are you sure you want to change the base?
Challenge tabs #90
Conversation
ssynowiec
commented
Mar 9, 2023
•
edited
Loading
edited
apps/web/components/organisms/newOpinionForm/newOpinionForm.tsx
Outdated
Show resolved
Hide resolved
apps/web/components/organisms/protectedPage/protectedComponent/protectedComponent.tsx
Outdated
Show resolved
Hide resolved
purple review Co-authored-by: prplblck <[email protected]>
apps/web/components/organisms/newOpinionForm/newOpinionForm.tsx
Outdated
Show resolved
Hide resolved
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.
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 💪
apps/web/components/molecules/commentItem/commentItemWithReply.tsx
Outdated
Show resolved
Hide resolved
<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"> |
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 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.
apps/web/components/molecules/commentItem/commentItemWithReply.tsx
Outdated
Show resolved
Hide resolved
apps/web/components/molecules/commentItem/commentItemWithReply.tsx
Outdated
Show resolved
Hide resolved
apps/web/components/organisms/newOpinionForm/newOpinionForm.tsx
Outdated
Show resolved
Hide resolved
|
||
type ProtectedComponentProps = { | ||
info?: string; | ||
children: ReactNode; |
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.
Maybe adding an optional slot for a component that should be displayed in case user is not logged in?
@@ -66,6 +67,9 @@ export const SingleChallengePage = ({ | |||
</div> | |||
</div> | |||
</section> | |||
<section> | |||
<Tabs /> |
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.
Maybe something like DiscussionTabs
or make it some discussion section?
apps/web/types/types.tsx
Outdated
author: string; | ||
avatar: string; | ||
comment: string; | ||
date: number; |
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.
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 /> |
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 buttons with icons are a good candidate for a separate component as well ;)
|
||
type CommentItemProps = Comment; | ||
|
||
export const CommentItem = ({ | ||
author, | ||
avatar, | ||
comment, | ||
date, | ||
timestamp, | ||
}: CommentItemProps) => { |
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'd make a comment: Comment
prop accepting an object. No need for spreading then and you have everything contained in one object
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'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
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'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)
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.
We are getting somewhere 😉
const sizes = { | ||
24: 'w-24 h-24', | ||
12: 'w-12 h-12', | ||
10: 'w-10 h-10', | ||
}; |
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 can be placed outside of the component (above component declaration) as a const
SIZES
or AVATAR_SIZES