This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
// Usage: | |
// <WithConfirmation | |
// onClick={deletePost} | |
// confirmationMessage="Are you sure you want to delete this post?" | |
// renderButton={({ onClick }) => { | |
// return ( | |
// <button onClick={onClick}> | |
// Delete post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom hook for dynamically resizing a textarea to fit its content. | |
* @param {React.RefObject<HTMLTextAreaElement>} textareaRef - Reference to the textarea element. | |
* @param {string} textContent - Current text content of the textarea. | |
* @param {number} maxHeight - Optional: maxHeight of the textarea in pixels. | |
*/ | |
import { useEffect } from "react"; | |
export const useDynamicTextareaSize = ( |