MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / SidebarSectionHeading

Function SidebarSectionHeading

packages/app-core/src/components/Sidebar.tsx:205–253  ·  view source on GitHub ↗
({
  label,
  onDropPayload,
}: {
  label: string;
  onDropPayload?: (payload: DragPayload) => void | Promise<void>;
})

Source from the content-addressed store, hash-verified

203}
204
205function SidebarSectionHeading({
206 label,
207 onDropPayload,
208}: {
209 label: string;
210 onDropPayload?: (payload: DragPayload) => void | Promise<void>;
211}): JSX.Element {
212 const [dragHover, setDragHover] = useState(false);
213 const droppable = !!onDropPayload;
214
215 return (
216 <div
217 className={[
218 "rounded-lg px-2 pb-2 pt-4 text-xs font-medium uppercase tracking-wide transition-colors",
219 dragHover ? "bg-accent/10 text-accent" : "text-ink-500",
220 ].join(" ")}
221 onDragOver={
222 droppable
223 ? (e) => {
224 if (!hasZenItem(e)) return;
225 e.preventDefault();
226 e.dataTransfer.dropEffect = "move";
227 setDragHover(true);
228 }
229 : undefined
230 }
231 onDragLeave={
232 droppable
233 ? () => {
234 setDragHover(false);
235 }
236 : undefined
237 }
238 onDrop={
239 droppable
240 ? (e) => {
241 setDragHover(false);
242 const payload = readDragPayload(e);
243 if (!payload) return;
244 e.preventDefault();
245 void onDropPayload(payload);
246 }
247 : undefined
248 }
249 >
250 {label}
251 </div>
252 );
253}
254
255function vaultRelativeFolderPath(
256 folder: NoteFolder,

Callers

nothing calls this directly

Calls 2

hasZenItemFunction · 0.90
readDragPayloadFunction · 0.90

Tested by

no test coverage detected