Skip to content
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

[BugFix] Description word-break 이슈 수정 #153

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions apps/client/src/features/task/components/TaskDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function TaskDescription({ initialDescription = '' }: TaskDescriptionProp
from: '/_auth/$project/board/$taskId',
});
const [isEdit, setIsEdit] = useState(false);
const [description, setDescription] = useState(initialDescription);
const [description, setDescription] = useState<string>(initialDescription);
const prevDescriptionRef = useRef(description);

const { updateDescription } = useTaskMutations(taskId);
Expand All @@ -32,15 +32,15 @@ export function TaskDescription({ initialDescription = '' }: TaskDescriptionProp
};

return (
<div>
<h3 className="mb-2 text-lg font-medium">Description</h3>
<div className="max-h-[calc(50vh-58px)]">
<h3 className="text-lg font-medium">Description</h3>
{isEdit ? (
<div className="space-y-2">
<div className="max-h-[calc(50vh-86px)] space-y-2">
<Textarea
value={description}
placeholder="Description should be here..."
onChange={(e) => setDescription(e.target.value)}
className="min-h-[100px]"
className="max-h-[calc(50vh-126px)] min-h-32 w-full overflow-y-auto"
autoFocus
/>
<div className="flex justify-end gap-2">
Expand All @@ -53,12 +53,12 @@ export function TaskDescription({ initialDescription = '' }: TaskDescriptionProp
</div>
</div>
) : (
<p
className="cursor-pointer rounded p-2 text-gray-700 hover:bg-gray-50"
<div
className="max-h-[calc(50vh-86px)] max-w-full cursor-pointer overflow-y-auto whitespace-pre-wrap break-words rounded p-2 text-gray-700 hover:bg-gray-50"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@iam454
아침에 해주셨던 말씀처럼, 스타일 속성 (whitespace: pre-wrap)으로도 처리가 가능하더라고요!

onDoubleClick={handleDoubleClick}
>
{description.length === 0 ? 'Double click to edit' : description}
</p>
</div>
)}
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/features/task/subtask/components/Subtasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export function Subtasks({ initialSubtasks = [] }: SubtasksProps) {
}, [subtasks.length]);

return (
<div>
<div className="max-h-[calc(50vh-58px)]">
<h3 className="mb-2 text-lg font-medium">Subtasks</h3>
<div className="max-h-96 space-y-0.5 overflow-y-auto" ref={subtasksRef}>
<div className="max-h-[calc(50vh-166px)] space-y-0.5 overflow-y-auto" ref={subtasksRef}>
{subtasks.map((subtask) => (
<SubtaskItem
key={subtask.id}
Expand Down
Loading