Skip to content

Commit

Permalink
ENH Use li for multi links
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 2, 2024
1 parent fc56c05 commit 5864546
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions client/src/components/LinkField/LinkField.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,14 @@ const LinkField = ({
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
>
<SortableContext
items={linkIDs}
strategy={verticalListSortingStrategy}
>
{links}
</SortableContext>
<ol className="link-picker__list">
<SortableContext
items={linkIDs}
strategy={verticalListSortingStrategy}
>
{links}
</SortableContext>
</ol>
</DndContext>
</div>
}
Expand Down Expand Up @@ -483,6 +485,7 @@ const LinkField = ({
isKeyboardEditing={isKeyboardEditing}
/> }
{sortableLinks()}
{ /* This <LinkModalContainer> is only used for editing EXISTING links */ }
{ renderModal && <LinkModalContainer
types={types}
typeKey={data[editingID]?.typeKey}
Expand Down
1 change: 1 addition & 0 deletions client/src/components/LinkField/LinkField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
box-shadow: none;
}
}

1 change: 1 addition & 0 deletions client/src/components/LinkPicker/LinkPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const LinkPicker = ({
onSelect={handleSelect}
onKeyDownEdit={onKeyDownEdit}
/>
{ /* This <LinkModalContainer> is only used for editing NEW links */ }
{ shouldOpenModal && <LinkModalContainer
types={types}
typeKey={typeKey}
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/LinkPicker/LinkPicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
}
}

.link-picker__list {
padding-left: 0;
}

.link-picker__drag-handle {
left: 5px;
position: absolute;
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/LinkPicker/LinkPickerTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ const LinkPickerTitle = ({
// add this to the drag handle instead
delete attributes.tabIndex;
const idAttr = `link-picker__link-${id}`;
return <div
const Tag = isMulti ? 'li' : 'div';
return <Tag
className={className}
ref={setNodeRef}
style={style}
Expand Down Expand Up @@ -176,7 +177,7 @@ const LinkPickerTitle = ({
>{deleteText}</span>
}
</Button>
</div>
</Tag>
};

LinkPickerTitle.propTypes = {
Expand Down

0 comments on commit 5864546

Please sign in to comment.