mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
refactor(button): refactor ResetButton to accept value prop
This commit is contained in:
parent
2a47b469b0
commit
d33f214450
@ -1,17 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import { RotateCcw } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useCodeEditorStore } from "@/store/useCodeEditorStore";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { DEFAULT_EDITOR_VALUE } from "@/config/editor/value";
|
||||
import { RotateCcw } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useCodeEditorStore } from "@/store/useCodeEditorStore";
|
||||
|
||||
export default function ResetButton() {
|
||||
interface ResetButtonProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export default function ResetButton({
|
||||
value
|
||||
}: ResetButtonProps) {
|
||||
const { editor, language } = useCodeEditorStore();
|
||||
|
||||
return (
|
||||
@ -24,7 +29,6 @@ export default function ResetButton() {
|
||||
aria-label="Reset Code"
|
||||
onClick={() => {
|
||||
if (editor) {
|
||||
const value = DEFAULT_EDITOR_VALUE[language];
|
||||
const model = editor.getModel();
|
||||
if (model) {
|
||||
const fullRange = model.getFullModelRange();
|
||||
|
@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useRef, useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CheckIcon, CopyIcon } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface CodeBlockWithCopyProps {
|
||||
children: React.ReactNode;
|
||||
|
Loading…
Reference in New Issue
Block a user