-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/GU-99/grow-up-fe into fe…
…ature/#165-team-update-modal
- Loading branch information
Showing
25 changed files
with
396 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { useFormContext } from 'react-hook-form'; | ||
import type { RegisterOptions } from 'react-hook-form'; | ||
|
||
type DescriptionTextareaProps = { | ||
id: string; | ||
label: string; | ||
fieldName: string; | ||
validationRole?: RegisterOptions; | ||
placeholder?: string; | ||
errors?: string; | ||
}; | ||
|
||
export default function DescriptionTextarea({ | ||
id, | ||
label, | ||
fieldName, | ||
placeholder, | ||
validationRole, | ||
errors, | ||
}: DescriptionTextareaProps) { | ||
const { register } = useFormContext(); | ||
|
||
return ( | ||
<label htmlFor={id}> | ||
<h3 className="text-large">{label}</h3> | ||
<textarea | ||
id={id} | ||
className="h-100 w-full rounded-md border border-input p-10 text-regular placeholder:text-xs" | ||
placeholder={placeholder} | ||
{...(validationRole ? register(fieldName, validationRole) : register(fieldName))} | ||
/> | ||
<div className={`my-5 h-10 text-xs text-error ${errors ? 'visible' : 'invisible'}`}>{errors}</div> | ||
</label> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import { IoMdCloseCircle } from 'react-icons/io'; | ||
import type { User } from '@/types/UserType'; | ||
import type { RoleName, TeamRoleName } from '@/types/RoleType'; | ||
import { PROJECT_ROLES, TEAM_ROLES } from '@/constants/role'; | ||
|
||
type CheckTeamRole<T> = T extends TeamRoleName ? 'MATE' : 'ASSIGNEE'; | ||
type UserRoleSelectBoxProps<T extends RoleName> = { | ||
userId: User['userId']; | ||
nickname: User['nickname']; | ||
defaultValue: CheckTeamRole<T>; | ||
roles: typeof TEAM_ROLES | typeof PROJECT_ROLES; | ||
onRoleChange: (userId: number, roleName: T) => void; | ||
onRemoveUser: (userId: number) => void; | ||
}; | ||
|
||
export default function UserRoleSelectBox<T extends RoleName>({ | ||
userId, | ||
nickname, | ||
defaultValue, | ||
roles, | ||
onRoleChange, | ||
onRemoveUser, | ||
}: UserRoleSelectBoxProps<T>) { | ||
const handleRoleChange = (event: React.ChangeEvent<HTMLSelectElement>) => { | ||
onRoleChange(userId, event.target.value as T); | ||
}; | ||
|
||
return ( | ||
<div className="ml-4 mt-4 flex items-center text-sm"> | ||
<select | ||
onChange={handleRoleChange} | ||
className="mr-2 appearance-none rounded-l-lg border-none bg-gray-200 py-2 pl-4 pr-2" | ||
defaultValue={defaultValue} | ||
> | ||
{roles.map((role) => ( | ||
<option key={role} value={role}> | ||
{role} | ||
</option> | ||
))} | ||
</select> | ||
|
||
<div className="flex items-center justify-between rounded-r-lg bg-gray-200 p-2"> | ||
<span>{nickname}</span> | ||
<button type="button" className="ml-2" onClick={() => onRemoveUser(userId)} aria-label="유저 제거"> | ||
<IoMdCloseCircle className="size-10 cursor-pointer text-close hover:text-[#DF0000]" /> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.