김재형

Add actions for folder

1 -import React, { useState } from "react"; 1 +import React, { useState, Fragment } from "react";
2 import { Popconfirm, Popover, Button, message } from "antd"; 2 import { Popconfirm, Popover, Button, message } from "antd";
3 import { FileItem } from "./useFileList"; 3 import { FileItem } from "./useFileList";
4 import styles from "./FileItemActions.module.scss"; 4 import styles from "./FileItemActions.module.scss";
...@@ -52,9 +52,11 @@ export function FileItemActions({ ...@@ -52,9 +52,11 @@ export function FileItemActions({
52 이름 변경 52 이름 변경
53 </Button> 53 </Button>
54 </Popover> 54 </Popover>
55 + {!item.is_folder && (
55 <Button type="link" size="small"> 56 <Button type="link" size="small">
56 공유 57 공유
57 </Button> 58 </Button>
59 + )}
58 <Popover 60 <Popover
59 title="이동할 폴더를 선택하세요" 61 title="이동할 폴더를 선택하세요"
60 content={ 62 content={
...@@ -78,6 +80,7 @@ export function FileItemActions({ ...@@ -78,6 +80,7 @@ export function FileItemActions({
78 이동 80 이동
79 </Button> 81 </Button>
80 </Popover> 82 </Popover>
83 + {!item.is_folder && (
81 <Popover 84 <Popover
82 title="복사할 폴더를 선택하세요" 85 title="복사할 폴더를 선택하세요"
83 content={ 86 content={
...@@ -98,6 +101,8 @@ export function FileItemActions({ ...@@ -98,6 +101,8 @@ export function FileItemActions({
98 복사 101 복사
99 </Button> 102 </Button>
100 </Popover> 103 </Popover>
104 + )}
105 + {!item.is_folder && (
101 <Popconfirm 106 <Popconfirm
102 title="정말로 삭제하시겠습니까?" 107 title="정말로 삭제하시겠습니까?"
103 onConfirm={() => onDelete(item.id)} 108 onConfirm={() => onDelete(item.id)}
...@@ -108,6 +113,7 @@ export function FileItemActions({ ...@@ -108,6 +113,7 @@ export function FileItemActions({
108 삭제 113 삭제
109 </Button> 114 </Button>
110 </Popconfirm> 115 </Popconfirm>
116 + )}
111 </div> 117 </div>
112 ); 118 );
113 } 119 }
......
...@@ -152,15 +152,14 @@ function getColumns({ ...@@ -152,15 +152,14 @@ function getColumns({
152 dataIndex: "size", 152 dataIndex: "size",
153 width: 120, 153 width: 120,
154 render: (bytes: number, item) => 154 render: (bytes: number, item) =>
155 - item.is_folder ? "" : filesize(bytes, { round: 0 }), 155 + item.is_folder ? "-" : filesize(bytes, { round: 0 }),
156 }, 156 },
157 { 157 {
158 title: "", 158 title: "",
159 key: "action", 159 key: "action",
160 dataIndex: "", 160 dataIndex: "",
161 width: 300, 161 width: 300,
162 - render: (__: any, item) => 162 + render: (__: any, item) => (
163 - item.is_folder ? null : (
164 <FileItemActions 163 <FileItemActions
165 item={item} 164 item={item}
166 onRename={handleRename} 165 onRename={handleRename}
......