Skip to content

Conversation

@AndrewHUNGNguyen
Copy link

Created red borders for required fields (See below screenshot):

  • Full Name
  • Photo upload
  • Handle textbox
image

Ensured that following original behaviors are not impacted:

  • Able to finish setup on required fields
  • Users attempting to use an existing handle as their namecard handle get blocked from creating a new namecard (See screenshot)
image - Successful saving to the database locally (See screenshot) image

@AndrewHUNGNguyen
Copy link
Author

@samholmes when you are free, this PR will be ready for you and hope this will be good by Saturday's monthly meetup 🙂

Copy link
Contributor

@samholmes samholmes left a comment

Choose a reason for hiding this comment

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

These requested changes are minor but worthwhile. Great work!


const FieldError = styled.p`
color: #f87171;
font-size: 0.75rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

font-size here is not consistent with font-size in TextInput.

`

const FieldError = styled.p`
color: #f87171;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider defining a color --error-color: #f87171 in :root declaration in globals.css. This way we have a consistent color as part of our theming.


const FieldError = styled.p`
color: #f87171;
font-size: 0.875rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

font-size 0.75rem to be consistent with the other FieldError in the nametag?

Comment on lines +363 to +370
onImageUpload={async (file) => {
const url = await handleImageUpload(file)
// Clear photo error immediately when photo is uploaded
if (hasAttemptedSubmit && validationErrors.profilePhoto) {
setValidationErrors((prev) => ({ ...prev, profilePhoto: false }))
}
return url
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of inlining a new handler function, move your implementation to the handleImageUpload handler. Rework your changes into that existing handler.

Comment on lines +373 to +383
onDataChange={(data) => {
setNametagData(data)
// Clear errors when user provides valid data
if (hasAttemptedSubmit) {
setValidationErrors((prev) => ({
...prev,
profilePhoto: !data.profilePhoto,
fullName: !data.fullName.trim()
}))
}
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of inlining a new handler function, move your implementation to the a handleDataChange handler.

Comment on lines +321 to +327
onChange={(e) => {
setHandle(e.target.value.toLowerCase())
// Clear error when user starts typing
if (hasAttemptedSubmit && validationErrors.handle) {
setValidationErrors((prev) => ({ ...prev, handle: false }))
}
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to a handleHandleChange. Hah, that's a funny name. Typical naming convention for handler functions is handle[semantic][event], in this case the semantic is "handle" because that's what we call the username, and the event is "Change" because it's for "onChange". Hence the weird sounding name.

Comment on lines +55 to +58
if (props.$error) {
return "#f87171"
}
return props.$variant === "secondary" ? "white" : "rgba(0, 0, 0, 0.4)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Might as well change the ternary here to an if statement while we're at it.

if (props.$error) {
return "1px solid #f87171"
}
return props.$variant === "secondary"
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider replacing ternary to if statement

<NametagLeft>
<PhotoFrame onClick={readOnly ? undefined : () => fileInputRef.current?.click()}>
<PhotoFrame
onClick={readOnly ? undefined : () => fileInputRef.current?.click()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Define a handlePhotoFrameClick handler function and implement the logic there.

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.

2 participants