Skip to content

Commit

Permalink
Fix glitchy looking dragging item overdrag borders (aeharding#5)
Browse files Browse the repository at this point in the history
* Fix glitchy looking dragging item overdrag borders

* Fix grey bg hack
  • Loading branch information
aeharding authored Jun 23, 2023
1 parent 2704978 commit 354fc51
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
13 changes: 7 additions & 6 deletions src/features/comment/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ export default function Comment({
}

return (
<AnimateHeight
duration={200}
height={fullyCollapsed ? 0 : "auto"}
className={className}
>
<DraggingVote onVote={onVote} currentVote={currentVote} onReply={onReply}>
<AnimateHeight duration={200} height={fullyCollapsed ? 0 : "auto"}>
<DraggingVote
onVote={onVote}
currentVote={currentVote}
onReply={onReply}
className={className}
>
<CustomIonItem
routerLink={routerLink}
href={undefined}
Expand Down
2 changes: 1 addition & 1 deletion src/features/post/inFeed/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export default function Post({ post, communityMode, className }: PostProps) {
if (!jwt) return login({ presentingElement: pageContext.page });
else reply({ presentingElement: pageContext.page });
}}
className={className}
>
{/* href=undefined: Prevent drag failure on firefox */}
<CustomIonItem
Expand All @@ -235,7 +236,6 @@ export default function Post({ post, communityMode, className }: PostProps) {
`/c/${getHandle(post.community)}/comments/${post.post.id}`
)}
href={undefined}
className={className}
>
<Container>
<div>
Expand Down
8 changes: 6 additions & 2 deletions src/features/shared/DraggingVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import {
import { arrowDownSharp, arrowUndo, arrowUpSharp } from "ionicons/icons";
import React, { useEffect, useRef, useState } from "react";

const StyledIonItemSliding = styled(IonItemSliding)`
--ion-item-border-color: transparent;
`;

const Action = styled(IonIcon)<{ active: boolean }>`
display: flex;
align-items: center;
Expand Down Expand Up @@ -97,7 +101,7 @@ export default function DraggingVote({
}

return (
<IonItemSliding
<StyledIonItemSliding
onIonDrag={async (e) => {
dragRef.current = e;
const ratio = await e.target.getSlidingRatio();
Expand Down Expand Up @@ -130,6 +134,6 @@ export default function DraggingVote({
</IonItemOption>
</IonItemOptions>
{children}
</IonItemSliding>
</StyledIonItemSliding>
);
}
2 changes: 1 addition & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ion-tab-button {
.ios .grey-bg {
--ion-background-color: var(--ion-color-step-50, #f2f2f7);
}
.ios body:has(.grey-bg:not([aria-hidden="true"])) {
.ios body:has(.grey-bg:not([aria-hidden="true"]):not([style*="pointer"])) {
--ion-background-color: var(--ion-color-step-50, #f2f2f7);
}
.ios .grey-bg ion-header {
Expand Down

0 comments on commit 354fc51

Please sign in to comment.