-
Notifications
You must be signed in to change notification settings - Fork 0
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
Directory and Post Modal with design changes #54
base: main
Are you sure you want to change the base?
Conversation
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.
Great First task. Just a few things to change up and fix since some of the code isn't working as intended.
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.
Let's move the components folder outside of apps. so it'll be src/components
|
||
/* Button hover effect */ | ||
.modal-actions button:hover { | ||
background-color: #f0f0f0; |
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.
border-radius: 4px; | ||
cursor: pointer; | ||
font-size: 16px; /* Set size for buttons */ | ||
color: #333; /* Set color for buttons */ |
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.
Double check the colors with design #333 doesn't seem to be one of the colors the designers used
ALso leveraged the color variables defined in global.css instead of using the colors directly when possible
message: errorMessages.message?._errors[0], | ||
}); | ||
return; | ||
} |
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.
https://react-hook-form.com/get-started
Can we use react-hook-form?
It'll work with zod to do the error checking so you don't have to do this. most of this
We don't want to be disabling linter errors these ones are avoidable
<button type="button" onClick={onClose}> | ||
Cancel | ||
</button> | ||
<button type="submit">Submit</button> |
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.
Thus button has the wrong hover color
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.
Same thing, we shouldn't be disabeling the linter here
react-hook-form should help with the errors
type="text" | ||
value={website} | ||
onChange={(e) => { | ||
setInstitution(e.target.value); |
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.
wrong_ set function
onChange={(e) => { | ||
setInstitution(e.target.value); | ||
}} | ||
placeholder="Phone" |
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.
wrong place holder text
onChange={handleCountryChange} | ||
className={country ? "country-selected" : ""} | ||
> | ||
<option value="" disabled> |
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.
<button | ||
type="button" | ||
className="save-button" | ||
onClick={() => { |
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.
save button doesn't trigger the console.log nor the form submit.
you need type='submit' for the submission
Somehow keep getting dependency incompatibilities with postcss and tailwind, probably just an issue on my end |
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.
Almost there
Great new Post just needs a few changes
The directory personal info modal needs a bit more of a styling change to make sure it fits within the screen
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.
missing react-hook-form
need to npm install react-hook-form
in the frontend folder
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.
Also missing @hookform/resolvers
package
} | ||
|
||
h2 { | ||
@apply text-mainHeading; |
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.
heading text should be black
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.close-button { |
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.
the close button is outside of the modal
you are likely missing a position rule on this element or its parent element
take a look at how Kiruthika wrote hers yours. The same css rules should apply to ours. (position absolute on the close and position relative on the container of the close button) (line 29 and 35)
position: absolute; |
label { | ||
display: block; | ||
margin-bottom: 3px; | ||
color: #333; |
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.
figma has the text as black
width: 100%; | ||
padding: 10px; | ||
font-size: 1rem; | ||
border: 1px solid #ccc; |
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 don't think ccc is the right color code for the border i think its #b4b4b4`
<div className="modal-overlay"> | ||
<div className="modal-container"> | ||
<h2>Create New Post</h2> | ||
<form onSubmit={handleSubmit(submitForm)}> |
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.
change the on submit to
(e) => { e.preventDefault(); void handleSubmit(onSubmit)(e); }
which should take care of one of the linter errors.
But the code above in a function name it then pass it to the form to make it more readable use a useCallback on it too
|
||
if (!isOpen) return null; | ||
|
||
const submitForm = (data: PostFormData) => { |
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.
wrap in usecallback
<div className="form-group"> | ||
<label htmlFor="post-message">Message</label> | ||
<textarea id="post-message" {...register("message")} placeholder="Message" /> | ||
{errors.message && <p className="error-message">{errors.message.message}</p>} |
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.
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.
same as the directory modal change the way the
tag is there so its always there thus leaving space for the error message so the screen/rendering doesn't move as much when the message shows
<button className="close-button" onClick={onClose}> | ||
× | ||
</button> | ||
<h2>Edit Directory Info</h2> |
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.
<h2>Edit Directory Info</h2> | |
<h2>Edit Personal Info</h2> |
lets match the design text
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.
Tracking Info
Resolves #21 #23
Changes
Testing
Confirmation of Change