Skip to content

Commit

Permalink
Merge pull request #3294 from serlo/fix/droppable-blank-size-margins
Browse files Browse the repository at this point in the history
fix(blank): droppable blank styling improvements
  • Loading branch information
hejtful authored Jan 18, 2024
2 parents 61f7cb0 + 01fe6c6 commit 67c297a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export const blankDraggableAnswerDragType = 'blank-solution'
interface BlankDraggableAnswerProps {
text: string
draggableId: DraggableId
isPending?: boolean
isAnswerCorrect?: boolean
}

export function BlankDraggableAnswer(props: BlankDraggableAnswerProps) {
const { draggableId, text, isAnswerCorrect } = props
const { draggableId, text, isPending, isAnswerCorrect } = props

const [, dragRef] = useDrag({
type: blankDraggableAnswerDragType,
Expand All @@ -22,9 +23,10 @@ export function BlankDraggableAnswer(props: BlankDraggableAnswerProps) {
return (
<span
className={cn(
'rounded-full border border-editor-primary-300 bg-editor-primary-100 px-2',
'cursor-grab rounded-full border border-editor-primary-300 bg-editor-primary-100 px-2',
isAnswerCorrect && 'border-green-500',
isAnswerCorrect === false && 'border-red-500'
isAnswerCorrect === false && 'border-red-500',
isPending && 'mr-2'
)}
ref={dragRef}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export function DroppableBlank(props: DroppableBlankProps) {
<span
className={cn(
!children &&
'rounded-full border border-editor-primary-300 bg-editor-primary-100 px-2',
'rounded-full border border-editor-primary-300 bg-editor-primary-100 px-6 text-editor-primary-100',
isOver && !isDisabled && 'bg-slate-400'
)}
ref={dropRef}
>
{children}
{children || '_'}
</span>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function FillInTheBlanksRenderer(props: FillInTheBlanksRendererProps) {
<BlankDraggableArea onDrop={handleDraggableAreaDrop}>
{draggables.map((draggable, index) =>
locationOfDraggables.get(draggable.draggableId) ? null : (
<BlankDraggableAnswer key={index} {...draggable} />
<BlankDraggableAnswer key={index} isPending {...draggable} />
)
)}
</BlankDraggableArea>
Expand Down

0 comments on commit 67c297a

Please sign in to comment.