diff --git a/src/app/(dashboard)/page.tsx b/src/app/(dashboard)/page.tsx index 3835561..9aa1351 100644 --- a/src/app/(dashboard)/page.tsx +++ b/src/app/(dashboard)/page.tsx @@ -36,6 +36,7 @@ import Link from "next/link"; import StickyTopContainer from "@/components/sticky-top-container"; import { useRouter } from "next/navigation"; import truncate from "@/lib/truncate"; +import SwipeToDelete, { useSwipeToDeleteContext } from "@/components/swipe-to-delete"; type SortingType = "byCreationDate" | "byEditDate" @@ -274,9 +275,9 @@ const ProjectDropdown = ({ {selected ? : }{selected ? "Deselect" : "Select"} - + + +
+ {children} +
+ + ); +}; \ No newline at end of file diff --git a/src/components/swipe-to-delete/index.ts b/src/components/swipe-to-delete/index.ts new file mode 100644 index 0000000..ff2dd59 --- /dev/null +++ b/src/components/swipe-to-delete/index.ts @@ -0,0 +1,7 @@ +import { SwipeToDelete, SwipeToDeleteContextProvider, useSwipeToDeleteContext } from "./SwipeToDelete"; + +export default SwipeToDelete; +export { + SwipeToDeleteContextProvider, + useSwipeToDeleteContext +}; \ No newline at end of file diff --git a/src/components/swipe-to-delete/styles.css b/src/components/swipe-to-delete/styles.css new file mode 100644 index 0000000..f4a74ea --- /dev/null +++ b/src/components/swipe-to-delete/styles.css @@ -0,0 +1,77 @@ +/* rstdi = react-swipe-to-delete-ios */ + +.rstdi { + --rstdiHeight: 30px; + --rstdiTransitionDuration: 250ms; + --rstdiTranslate: 0px; + --rstdiIsRtl: 0; + --rstdiDeleteColor: rgba(252, 58, 48, 1); + --rstdiDeleteWidth: 75px; + --rstdiButtonMarginRight: 0px; + --rstdiButtonMarginLeft: 0px; + + width: auto; + position: relative; + box-sizing: border-box; + overflow: hidden; + height: 100%; + max-height: 100%; +} + +.rstdi *, +.rstdi *:before, +.rstdi *:after { + box-sizing: border-box; +} + +.rstdi.deleting { + transition: all var(--rstdiTransitionDuration) ease-out; + opacity: 0; + max-height: 0; +} + +.rstdi .content { + height: 100%; + width: auto; + position: relative; + transform: translateX(var(--rstdiTranslate)); +} + +.rstdi .content.transition { + transition: all var(--rstdiTransitionDuration) ease-out; +} + +.rstdi .content.deleting { + height: 0%; + width: auto; + position: relative; + transform: translateX(-100%); + transition: all var(--rstdiTransitionDuration) ease-out; +} + +.rstdi .delete { + position: absolute; + right: 0; + margin-top: 1px; + height: calc(100% - 3px); + width: 100%; + top: 0; + background: var(--rstdiDeleteColor); + font-weight: 400; + display: inline-flex; + justify-content: flex-start; + align-items: center; +} + +.rstdi .delete button { + width: var(--rstdiDeleteWidth); + transition: transform var(--rstdiTransitionDuration) ease-out; + transform: translateX(var(--rstdiButtonMarginLeft)); + text-align: center; + height: 100%; + background: transparent; + border: none; + color: white; + font-size: 1rem; + cursor: pointer; +} \ No newline at end of file