mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
before more styling things
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
DraggableItem,
|
DraggableItem,
|
||||||
} from "../../context/draggingContext";
|
} from "../../context/draggingContext";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
|
import ClientOnly from "@/components/ClientOnly";
|
||||||
|
|
||||||
export function ItemInDay({
|
export function ItemInDay({
|
||||||
type,
|
type,
|
||||||
@@ -59,11 +60,13 @@ export function ItemInDay({
|
|||||||
>
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
<ClientOnly>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
message={message}
|
message={message}
|
||||||
targetRef={linkRef}
|
targetRef={linkRef}
|
||||||
visible={tooltipVisible && status === "incomplete"}
|
visible={tooltipVisible && status === "incomplete"}
|
||||||
/>
|
/>
|
||||||
|
</ClientOnly>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -73,24 +76,14 @@ const Tooltip: React.FC<{
|
|||||||
targetRef: React.RefObject<HTMLElement>;
|
targetRef: React.RefObject<HTMLElement>;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
}> = ({ message, targetRef, visible }) => {
|
}> = ({ message, targetRef, visible }) => {
|
||||||
const [position, setPosition] = useState({ top: 0, left: 0 });
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (targetRef.current) {
|
|
||||||
const rect = targetRef.current.getBoundingClientRect();
|
|
||||||
setPosition({
|
|
||||||
top: rect.bottom + window.scrollY + 10,
|
|
||||||
left: rect.left + window.scrollX + rect.width / 2,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [targetRef]);
|
|
||||||
|
|
||||||
|
const rect = targetRef.current?.getBoundingClientRect();
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
top: position.top,
|
top: (rect?.bottom ?? 0) + window.scrollY + 10,
|
||||||
left: position.left,
|
left: (rect?.left ?? 0) + window.scrollX + (rect?.width ?? 0) / 2,
|
||||||
}}
|
}}
|
||||||
className={
|
className={
|
||||||
" absolute -translate-x-1/2 " +
|
" absolute -translate-x-1/2 " +
|
||||||
@@ -98,7 +91,7 @@ const Tooltip: React.FC<{
|
|||||||
" rounded py-1 px-2 " +
|
" rounded py-1 px-2 " +
|
||||||
" transition-all duration-400 " +
|
" transition-all duration-400 " +
|
||||||
" border border-slate-700 shadow-[0_0px_10px_0px] shadow-slate-500/50 " +
|
" border border-slate-700 shadow-[0_0px_10px_0px] shadow-slate-500/50 " +
|
||||||
(visible ? " opacity-100 " : " opacity-0 -z-50 ")
|
(visible ? " " : " hidden -z-50 ")
|
||||||
}
|
}
|
||||||
role="tooltip"
|
role="tooltip"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -95,11 +95,13 @@ p {
|
|||||||
@apply mb-3;
|
@apply mb-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
button, .btn {
|
button,
|
||||||
|
.btn {
|
||||||
@apply font-bold py-1 px-3 rounded transition-all duration-200;
|
@apply font-bold py-1 px-3 rounded transition-all duration-200;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:not(.unstyled):not(.btn-danger), .btn:not(.unstyled):not(.btn-danger) {
|
button:not(.unstyled):not(.btn-danger),
|
||||||
|
.btn:not(.unstyled):not(.btn-danger) {
|
||||||
@apply bg-blue-900 hover:bg-blue-700 text-blue-50;
|
@apply bg-blue-900 hover:bg-blue-700 text-blue-50;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,3 +137,7 @@ select {
|
|||||||
.markdownPreview a {
|
.markdownPreview a {
|
||||||
@apply text-blue-500 hover:text-blue-600 font-bold underline;
|
@apply text-blue-500 hover:text-blue-600 font-bold underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* .isDragging .dayDropTarget {
|
||||||
|
@apply bg-slate-900 shadow-[0_0px_10px_0px] shadow-blue-800/50;
|
||||||
|
} */
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"use client"
|
"use client";
|
||||||
|
import { isServer } from "@tanstack/react-query";
|
||||||
import React, { ReactNode, useEffect, useState } from "react";
|
import React, { ReactNode, useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function ClientOnly({ children }: { children: ReactNode }) {
|
export default function ClientOnly({ children }: { children: ReactNode }) {
|
||||||
@@ -6,7 +7,7 @@ export default function ClientOnly({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsClient(true);
|
setIsClient(true);
|
||||||
}, []);
|
}, [isServer]);
|
||||||
|
|
||||||
if (!isClient) return <></>;
|
if (!isClient) return <></>;
|
||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function Modal({
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
"fixed inset-0 flex items-center justify-center transition-all duration-400 " +
|
" fixed inset-0 flex items-center justify-center transition-all duration-400 h-screen " +
|
||||||
" bg-black" +
|
" bg-black" +
|
||||||
(isOpen ? " bg-opacity-50 z-50 " : " bg-opacity-0 -z-50 ")
|
(isOpen ? " bg-opacity-50 z-50 " : " bg-opacity-0 -z-50 ")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user