Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

클라이언트 이미지 업로드 오류 해결 #624

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/components/home/AppendTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from 'react';
import { ReactNode, useRef } from 'react';
import { css, Theme } from '@emotion/react';
import { motion, Variants } from 'framer-motion';

Expand All @@ -12,6 +12,7 @@ import { IMAGE_INPUT_ID, ImgUploader } from '../add/ImgUploader';

export default function AppendTooltip() {
const { imgInputUploader } = useImgUpload({ isUploadPage: false });
const inputRef = useRef<HTMLInputElement>(null);

return (
<motion.div css={wrapperCss} variants={tooltipVariants}>
Expand All @@ -20,9 +21,9 @@ export default function AppendTooltip() {
href="/add/image"
icon={<ImageIcon />}
title="이미지"
htmlFor={IMAGE_INPUT_ID}
onClick={() => inputRef.current?.click()}
/>
<ImgUploader imgInputUploader={imgInputUploader} />
<ImgUploader imgInputUploader={imgInputUploader} ref={inputRef} />
<AnchorElement href="/add/link" icon={<LinkIcon />} title="링크" />
</motion.div>
);
Expand All @@ -46,12 +47,13 @@ interface AnchorElementProps {
icon: ReactNode;
title: string;
htmlFor?: string;
onClick?: () => void;
}

function AnchorElement({ href, icon, title, htmlFor }: AnchorElementProps) {
if (htmlFor) {
function AnchorElement({ href, icon, title, htmlFor, onClick }: AnchorElementProps) {
if (htmlFor || onClick) {
return (
<label css={anchorCss} htmlFor={htmlFor}>
<label css={anchorCss} htmlFor={htmlFor} onClick={onClick}>
{icon}
<span>{title}</span>
</label>
Expand Down
Loading