mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-02-01 20:31:51 +00:00
Update index.tsx
This commit is contained in:
parent
f1f1a7fa68
commit
70ef075ccd
@ -1,11 +1,8 @@
|
|||||||
// Folder: category-view
|
|
||||||
// File: index.tsx
|
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Card, CardContent, CardHeader } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader } from '@/components/ui/card';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Grid } from '@/components/ui/grid';
|
import { routes } from '@/routes'; // Assuming your route.ts file is at this location
|
||||||
import routes from '@/routes'; // Assuming your route.ts file is at this location
|
import { Grid } from '@mui/material'; // Using Material-UI's Grid
|
||||||
|
|
||||||
const CategoryView = () => {
|
const CategoryView = () => {
|
||||||
const [selectedCategory, setSelectedCategory] = useState(null);
|
const [selectedCategory, setSelectedCategory] = useState(null);
|
||||||
@ -34,27 +31,34 @@ const CategoryView = () => {
|
|||||||
Back to Categories
|
Back to Categories
|
||||||
</Button>
|
</Button>
|
||||||
<h2 className="text-xl font-semibold mb-4">{selectedCategory.name}</h2>
|
<h2 className="text-xl font-semibold mb-4">{selectedCategory.name}</h2>
|
||||||
<Grid cols={3} gap={4}>
|
<Grid container spacing={3}>
|
||||||
{selectedCategory.scripts
|
{selectedCategory.scripts
|
||||||
.sort((a, b) => a.name.localeCompare(b.name))
|
.sort((a, b) => a.name.localeCompare(b.name))
|
||||||
.map((script) => (
|
.map((script) => (
|
||||||
<Card key={script.name}>
|
<Grid item xs={12} sm={6} md={4} key={script.name}>
|
||||||
<CardContent>
|
<Card>
|
||||||
<h3 className="text-lg font-medium">{script.name}</h3>
|
<CardContent>
|
||||||
<p className="text-sm text-gray-600">{script.date}</p>
|
<h3 className="text-lg font-medium">{script.name}</h3>
|
||||||
</CardContent>
|
<p className="text-sm text-gray-600">{script.date}</p>
|
||||||
</Card>
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold mb-6">Categories</h1>
|
<h1 className="text-2xl font-bold mb-6">Categories</h1>
|
||||||
<Grid cols={3} gap={4}>
|
<Grid container spacing={3}>
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<Card key={category.name} onClick={() => handleCategoryClick(category)} className="cursor-pointer hover:shadow-lg">
|
<Grid item xs={12} sm={6} md={4} key={category.name}>
|
||||||
<CardHeader title={category.name} className="text-lg font-semibold" />
|
<Card
|
||||||
</Card>
|
onClick={() => handleCategoryClick(category)}
|
||||||
|
className="cursor-pointer hover:shadow-lg"
|
||||||
|
>
|
||||||
|
<CardHeader title={category.name} className="text-lg font-semibold" />
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user