mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
creating SKU generator from product.Title
This commit is contained in:
30
components/product/sku-generator.tsx
Normal file
30
components/product/sku-generator.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
'use client'
|
||||
|
||||
import { createProductSKUs } from "lib/helpers/skus";
|
||||
|
||||
|
||||
export function ProductSKUs(productInfo: {productTitle: string}) {
|
||||
const SKUs = createProductSKUs(productInfo.productTitle)
|
||||
|
||||
function copyText(e) {
|
||||
navigator.clipboard.writeText(e.target.value);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mx-auto max-w-screen-2xl px-4">
|
||||
<div className="rounded-lg border border-neutral-200 bg-white p-8 px-4 dark:border-neutral-800 dark:bg-black md:p-12 lg:grid lg:grid-cols-6">
|
||||
<div className="lg:col-span-3">
|
||||
{SKUs?.map(SKU => {
|
||||
return (
|
||||
<div className="my-4 w-full">
|
||||
<input type="text" value={SKU} onClick={copyText} className="cursor-pointer w-full border py-2 px-2" />
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
};
|
Reference in New Issue
Block a user