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

docs(editable): add docs for Editable #1445

Merged
merged 1 commit into from
Aug 24, 2023
Merged
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
24 changes: 24 additions & 0 deletions src/layouts/components/Editable/Editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ export interface EditableDraggableProps extends Omit<BoxProps, "onDragEnd"> {
onDragEnd: OnDragEndResponder
editableId: HomepageDroppableZone
}
/**
* This component provides the drag and drop context required for its children to be draggable.
* Do note that anything inside this component will be able to be dragged to.
*
* This means that children of this component **can interfere** with
* the draggable styling even if they are not draggable themselves.
* @param onDragEnd this should be a drag responder that determines the order
* of draggables once the drag handle has been released.
* @param editableId this determines the zone that the child draggables will be in.
*/
export const EditableDroppable = ({
onDragEnd,
children,
Expand Down Expand Up @@ -180,6 +190,12 @@ interface EditableCardProps {
}
// TODO: Break this up into individual sub-components
// that can be selectively used to create the card
/**
* This component displays an accordion item that can be expanded to show its children.
* It is not draggable and should not be part of any `Droppable` component
* to avoid style clashes during drag and drop.
* @param isInvalid this prop determines whether the error border will be present on collapse.
*/
const EditableAccordionItem = ({
title,
children,
Expand Down Expand Up @@ -228,6 +244,14 @@ interface DraggableAccordionItemProps {
}
// NOTE: Separating editable/draggable
// due to semantics on `Draggables`
/**
* This component displays an accordion item that can be expanded to show its children.
* This component is draggable and **needs** to be part of a `Droppable` component.
*
* Take note that this component is draggable on the entire card when collapsed
* and that only the chevron can be used to expand this component.
* @param isInvalid this prop determines whether the error border will be present on collapse.
*/
const DraggableAccordionItem = ({
tag,
title,
Expand Down