Comments (1)
Solved this by creating a separate cell action component:
const CellAction = ({ row }: CellContext<File, unknown>) => {
const file = row.original;
const { toast } = useToast();
const router = useRouter();
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="h-8 w-8 p-0">
<span className="sr-only">Open menu</span>
<MoreHorizontal className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
className='text-red-600 focus:text-red-700 bg-red-100/50'
onClick={ async () => {
const { success } = await deleteFileById(file.key)
if (!success) {
toast({
duration: 4000,
variant: "default",
description: `💥 Something went wrong, couldn't delete the file!`
})
return
}
toast({
duration: 4000,
variant: "success",
description: `🗑 Deleted successfully!`
})
router.refresh();
}}
>
<Trash className="mr-2 h-4 w-4" />
<span>Delete file</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}
And passing it in the column definition:
export const columns: ColumnDef<File>[] = [
{
...
},
{
id: "actions",
cell: CellAction,
}
]
from taxonomy.
Related Issues (20)
- Handle errors when you create a post with title lesser than 3 characters HOT 1
- Clarification on Copyright and License Usage for Open Source Templates
- The theme- toggle button shoud be in navbar so easier access
- Bug: 'Ctrl+K' doesn't work in Documentation page. HOT 2
- Error when running "pnpm dev" HOT 3
- Does anybody got this error too? HOT 2
- Streamline Berachain function navigation request
- Revolutionizing Taxonomy: Our Forking Adventure HOT 1
- Demo: Broken HOT 7
- Bump to latest version of Next JS?
- Content Layer page does not exist HOT 3
- Add the landingpage page
- Add a twitter logo after 'follow along on Twitter' in home page
- [Feature Request] Make Navbar fixed at the top of the page while scrolling HOT 1
- Export encountered errors on following paths: /(auth)/login/page: /login HOT 1
- [Bug]: different text colour for react 18 card in features section
- [Bug]: Footer UI has unnecessary margin between theme icon and text
- [Bug]: Wrong CSS at login button in Nav bar
- [Bug]: Signup form UI mis-aligned shifting to right side
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taxonomy.