Skip to content

Commit

Permalink
Recognise white space
Browse files Browse the repository at this point in the history
  • Loading branch information
patrikniebur committed Sep 22, 2023
1 parent b5ccce8 commit 9e08548
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ts/components/ExerciseItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const ExerciseItem = React.forwardRef<HTMLDivElement, Props>(

const isEdit = onTextChange ? true : false;



return (
<Card ref={ref} opacity={isDragging ? 0.5 : 1} w="100%" h="100%" pos="relative">
{exercise.error === EXERCISE_ERROR.NOT_IN_CONFIG && (
Expand Down Expand Up @@ -63,16 +61,16 @@ export const ExerciseItem = React.forwardRef<HTMLDivElement, Props>(
/>
)}
</Box>
{onTextChange ? (
{isEdit && onTextChange ? (
<Textarea
placeholder={exercise.fileName}
onChange={(e) => onTextChange(e.target.value)}
value={exercise.text}
/>
) : (
<Text fontSize="5xl">{exercise.text}</Text>
<Text fontSize="5xl" whiteSpace="pre-line">{exercise.text}</Text>
)}
{ onDelete && <Menu size="xs" variant="ghost" >
{ isEdit && onDelete && <Menu size="xs" variant="ghost" >
<MenuButton pos="absolute" right="0" top="0" size="xs" as={Button}>...</MenuButton>
<MenuList>
<MenuItem onClick={onDelete}>Delete</MenuItem>
Expand Down

0 comments on commit 9e08548

Please sign in to comment.