-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 5776a61 Author: 老J <hmmmbiubiubiu@gmail.com> Date: Fri May 31 13:43:31 2024 +0800 v1.3.0: Add quick input textarea. commit fc9be20 Author: 老J <hmmmbiubiubiu@gmail.com> Date: Fri May 31 13:39:49 2024 +0800 Add quick input textarea. commit af100c3 Author: 老J <hmmmbiubiubiu@gmail.com> Date: Fri May 31 08:18:02 2024 +0800 Add quick input textarea. commit dffeadf Author: 老J <hmmmbiubiubiu@gmail.com> Date: Thu May 30 08:24:47 2024 +0800 Add quick input textarea. commit 14829c9 Author: 老J <hmmmbiubiubiu@gmail.com> Date: Wed May 29 13:38:31 2024 +0800 Add quick input textarea. commit d4602f7 Author: 老J <hmmmbiubiubiu@gmail.com> Date: Tue May 28 20:10:33 2024 +0800 Add quick input area.
- Loading branch information
Showing
12 changed files
with
130 additions
and
47 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; | ||
import { useState, RefObject } from "react"; | ||
import { useTranslations } from "next-intl"; | ||
import { isDesktop } from "react-device-detect"; | ||
|
||
export default function QuickInput({ | ||
textareaRef, | ||
}: { | ||
textareaRef: RefObject<HTMLTextAreaElement>; | ||
}) { | ||
const [checked, setChecked] = useState<boolean>(false); | ||
const t = useTranslations("SyncClipboard"); | ||
|
||
const onChange = async () => { | ||
setChecked((current) => !current); | ||
if (textareaRef.current) { | ||
textareaRef.current.value = ""; | ||
!checked && textareaRef.current.focus(); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="pb-4"> | ||
<label> | ||
<input | ||
className="peer/showTextarea absolute scale-0" | ||
type="checkbox" | ||
onChange={onChange} | ||
/> | ||
<div className="flex justify-between items-center text-sm select-none opacity-70 peer-checked/showTextarea:pb-2 cursor-pointer"> | ||
<div> | ||
<span className="font-bold">{t("quickInput.title")}:</span> | ||
<span>{" " + t("quickInput.subTitle")}</span> | ||
{isDesktop && ( | ||
<span className="ml-1 text-xs opacity-50"> | ||
{t("quickInput.newline") + ": Shift+Enter"} | ||
</span> | ||
)} | ||
</div> | ||
<div className="ml-1 flex items-center"> | ||
{!checked && <ChevronDownIcon className="h-4 w-4" />} | ||
{checked && <ChevronUpIcon className="h-4 w-4" />} | ||
</div> | ||
</div> | ||
<textarea | ||
ref={textareaRef} | ||
className="textarea block rounded-box resize-none leading-tight w-full min-h-0 h-0 p-0 border-none peer-checked/showTextarea:border-solid peer-checked/showTextarea:textarea-bordered peer-checked/showTextarea:min-h-20 peer-checked/showTextarea:p-2 transition-all duration-400" | ||
></textarea> | ||
</label> | ||
</div> | ||
); | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v1.2.17 | ||
v1.3.0 |