-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a droppable and improve the styles
- Loading branch information
1 parent
09bf4e7
commit 67a22c9
Showing
4 changed files
with
127 additions
and
73 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
27 changes: 27 additions & 0 deletions
27
src/components/interactive-builder/draggable-question.scss
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 |
---|---|---|
@@ -1,7 +1,34 @@ | ||
@use '@carbon/styles/scss/type'; | ||
@use '@carbon/styles/scss/spacing'; | ||
@import '~@openmrs/esm-styleguide/src/vars'; | ||
|
||
.buttonsContainer { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.questionContainer { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.isDragged, .normal { | ||
display: flex; | ||
height: 3rem; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin: spacing.$spacing-02 spacing.$spacing-03; | ||
width: 100%; | ||
} | ||
|
||
.normal:hover { | ||
background-color: $ui-03; | ||
} | ||
.isDragged { | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
background-color: rgba(255, 255, 255, 0.552); | ||
} | ||
|
||
.draggableIcon { | ||
margin: spacing.$spacing-05 0; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/components/interactive-builder/droppable-container.component.tsx
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,18 @@ | ||
import React from "react"; | ||
import { useDroppable } from "@dnd-kit/core"; | ||
|
||
export function Droppable(props) { | ||
const { isOver, setNodeRef } = useDroppable({ | ||
id: props.id, | ||
}); | ||
|
||
const style = { | ||
border: `1px solid ${isOver ? "#3ddbd9" : "transparent"}`, | ||
}; | ||
|
||
return ( | ||
<div ref={setNodeRef} style={style}> | ||
{props.children} | ||
</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