chore: update dropdown component

This commit is contained in:
Steven
2022-09-12 21:17:23 +08:00
parent 840659e2b2
commit 0ba7a9e519
6 changed files with 312 additions and 251 deletions

View File

@@ -1,6 +1,7 @@
import { shortcutService } from "../services";
import Dropdown from "./common/Dropdown";
import showCreateShortcutDialog from "./CreateShortcutDialog";
import Icon from "./Icon";
interface Props {
workspaceId: WorkspaceId;
@@ -21,24 +22,30 @@ const ShortcutListView: React.FC<Props> = (props: Props) => {
<div key={shortcut.id} className="w-full flex flex-row justify-between items-start border px-6 py-4 mb-3 rounded-lg">
<div className="flex flex-col justify-start items-start">
<span className="text-lg font-medium">{shortcut.name}</span>
<span className="text-base text-gray-600">{shortcut.link}</span>
<a className="text-base text-gray-600 flex flex-row cursor-pointer hover:underline" target="blank" href={shortcut.link}>
{shortcut.link} <Icon.ExternalLink className="w-4 h-auto ml-1" />
</a>
</div>
<Dropdown>
<span
className="w-full px-2 leading-8 cursor-pointer rounded hover:bg-gray-100"
onClick={() => showCreateShortcutDialog(workspaceId, shortcut.id)}
>
Edit
</span>
<span
className="w-full px-2 leading-8 cursor-pointer rounded text-red-600 hover:bg-gray-100"
onClick={() => {
handleDeleteShortcutButtonClick(shortcut);
}}
>
Delete
</span>
</Dropdown>
<Dropdown
actions={
<>
<span
className="w-full px-2 leading-8 cursor-pointer rounded hover:bg-gray-100"
onClick={() => showCreateShortcutDialog(workspaceId, shortcut.id)}
>
Edit
</span>
<span
className="w-full px-2 leading-8 cursor-pointer rounded text-red-600 hover:bg-gray-100"
onClick={() => {
handleDeleteShortcutButtonClick(shortcut);
}}
>
Delete
</span>
</>
}
></Dropdown>
</div>
);
})}