Skip to content

Commit 849b8a9

Browse files
Clean up products section code review feedback (#50)
2 parents 4b35ba9 + 345a997 commit 849b8a9

3 files changed

Lines changed: 27 additions & 17 deletions

File tree

package-lock.json

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/home/products-section.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client"
22

3-
import { useState } from "react"
43
import Image from "next/image"
54
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
65
import { Container } from "@/components/ui/container"
@@ -85,7 +84,7 @@ Built with modern businesses in mind, StormERP integrates seamlessly with your e
8584
"Business Intelligence & Reporting",
8685
"Multi-Location & Multi-Currency Support"
8786
],
88-
productUrl: "https://erp.codestormhub.live",
87+
productUrl: "https://codestormhub.live/erp/dashboard",
8988
dashboardImage: "/products/stormerp-dashboard.png",
9089
status: "active",
9190
category: "ERP"
@@ -97,8 +96,6 @@ interface ProductsSectionProps {
9796
}
9897

9998
export default function ProductsSection({ className }: ProductsSectionProps) {
100-
const [selectedProduct, setSelectedProduct] = useState<Product | null>(null)
101-
10299
return (
103100
<section className={className} aria-labelledby="products-heading">
104101
<Container className="py-16 sm:py-24">
@@ -172,7 +169,6 @@ export default function ProductsSection({ className }: ProductsSectionProps) {
172169
variant="outline"
173170
size="sm"
174171
className="flex-1"
175-
onClick={() => setSelectedProduct(product)}
176172
>
177173
View Details
178174
</Button>
@@ -193,7 +189,10 @@ export default function ProductsSection({ className }: ProductsSectionProps) {
193189
</Card>
194190

195191
{/* Product Detail Modal */}
196-
<DialogContent className="max-w-5xl max-h-[90vh] overflow-y-auto">
192+
<DialogContent
193+
className="max-w-5xl max-h-[90vh] overflow-y-auto"
194+
aria-describedby={`product-description-${product.id}`}
195+
>
197196
<DialogHeader>
198197
<div className="flex items-center gap-3">
199198
<div className="w-12 h-12 rounded-xl bg-primary/20 flex items-center justify-center">
@@ -222,7 +221,7 @@ export default function ProductsSection({ className }: ProductsSectionProps) {
222221
</div>
223222

224223
{/* Description */}
225-
<div className="space-y-3">
224+
<div className="space-y-3" id={`product-description-${product.id}`}>
226225
<h4 className="text-lg font-semibold">About {product.name}</h4>
227226
<div className="text-muted-foreground whitespace-pre-line leading-relaxed">
228227
{product.fullDescription}

src/components/ui/dialog.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const DialogOverlay = React.forwardRef<
2929
))
3030
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
3131

32+
type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
33+
3234
const DialogContent = React.forwardRef<
3335
React.ElementRef<typeof DialogPrimitive.Content>,
3436
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
@@ -53,6 +55,8 @@ const DialogContent = React.forwardRef<
5355
))
5456
DialogContent.displayName = DialogPrimitive.Content.displayName
5557

58+
type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
59+
5660
const DialogHeader = ({
5761
className,
5862
...props
@@ -67,6 +71,8 @@ const DialogHeader = ({
6771
)
6872
DialogHeader.displayName = "DialogHeader"
6973

74+
type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement>
75+
7076
const DialogFooter = ({
7177
className,
7278
...props
@@ -81,6 +87,8 @@ const DialogFooter = ({
8187
)
8288
DialogFooter.displayName = "DialogFooter"
8389

90+
type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>
91+
8492
const DialogTitle = React.forwardRef<
8593
React.ElementRef<typeof DialogPrimitive.Title>,
8694
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
@@ -96,6 +104,8 @@ const DialogTitle = React.forwardRef<
96104
))
97105
DialogTitle.displayName = DialogPrimitive.Title.displayName
98106

107+
type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
108+
99109
const DialogDescription = React.forwardRef<
100110
React.ElementRef<typeof DialogPrimitive.Description>,
101111
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
@@ -108,6 +118,8 @@ const DialogDescription = React.forwardRef<
108118
))
109119
DialogDescription.displayName = DialogPrimitive.Description.displayName
110120

121+
type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
122+
111123
export {
112124
Dialog,
113125
DialogPortal,
@@ -120,3 +132,12 @@ export {
120132
DialogTitle,
121133
DialogDescription,
122134
}
135+
136+
export type {
137+
DialogOverlayProps,
138+
DialogContentProps,
139+
DialogHeaderProps,
140+
DialogFooterProps,
141+
DialogTitleProps,
142+
DialogDescriptionProps,
143+
}

0 commit comments

Comments
 (0)