-
+
+
{generateCode()}
@@ -860,10 +984,10 @@ export default function ComponentPlayground() {
{/* Preview Panel */}
-
+
-
+
Live Preview
@@ -875,42 +999,63 @@ export default function ComponentPlayground() {
{/* Preview Container */}
-
-
- {renderComponent()}
-
+
+ {renderComponent()}
{/* Component Info */}
-
+
- Component Info
+
+ Component Info
+
-
- Type: {selectedComponent.charAt(0).toUpperCase() + selectedComponent.slice(1)}
- Variant: {componentVariants[selectedComponent]?.[selectedVariant]?.name}
- Interactive: {selectedComponent === 'button' ? 'Yes (Click to test)' : selectedComponent === 'card' && selectedVariant === 'user' ? 'Yes (Click to test)' : 'Display only'}
+
+
+ Type:{" "}
+ {selectedComponent.charAt(0).toUpperCase() +
+ selectedComponent.slice(1)}
+
+
+ Variant:{" "}
+ {componentVariants[selectedComponent]?.[selectedVariant]?.name}
+
+
+ Interactive:{" "}
+ {selectedComponent === "button"
+ ? "Yes (Click to test)"
+ : selectedComponent === "card" && selectedVariant === "user"
+ ? "Yes (Click to test)"
+ : "Display only"}
+
{/* Quick Actions */}
-
-
-
+
+
+
Reset
-
-
+
+
Randomize
@@ -918,18 +1063,27 @@ export default function ComponentPlayground() {
toggleFavorite(selectedComponent, selectedVariant)}
- className={`px-4 py-2 rounded-lg text-sm font-medium transition-all flex items-center gap-2 ${isFavorite(selectedComponent, selectedVariant)
- ? 'bg-pink-500 text-white hover:bg-pink-600'
- : 'bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-pink-100 dark:hover:bg-pink-900/50'
- }`}
+ className={`px-4 py-2 rounded-lg text-sm font-medium transition-all flex-1 sm:flex-none flex items-center justify-center gap-2 ${
+ isFavorite(selectedComponent, selectedVariant)
+ ? "bg-pink-500 text-white hover:bg-pink-600"
+ : "bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-pink-100 dark:hover:bg-pink-900/50"
+ }`}
>
-
- {isFavorite(selectedComponent, selectedVariant) ? 'Remove Favorite' : 'Add Favorite'}
+
+ {isFavorite(selectedComponent, selectedVariant)
+ ? "Remove Favorite"
+ : "Add Favorite"}
Copy Code
@@ -961,13 +1115,21 @@ export default function ComponentPlayground() {
{favorites.length === 0 ? (
- No favorite components yet
- Click the heart icon on any component to add it to your favorites
+
+ No favorite components yet
+
+
+ Click the heart icon on any component to add it to your
+ favorites
+
) : (
{favorites.map((favorite) => {
- const variant = componentVariants[favorite.componentType]?.[favorite.variantKey];
+ const variant =
+ componentVariants[favorite.componentType]?.[
+ favorite.variantKey
+ ];
if (!variant) return null;
return (
@@ -987,7 +1149,10 @@ export default function ComponentPlayground() {
{
e.stopPropagation();
- toggleFavorite(favorite.componentType, favorite.variantKey);
+ toggleFavorite(
+ favorite.componentType,
+ favorite.variantKey
+ );
}}
className="text-pink-500 hover:text-pink-600 transition-colors"
>
@@ -995,7 +1160,9 @@ export default function ComponentPlayground() {
- {favorite.componentType.charAt(0).toUpperCase() + favorite.componentType.slice(1)} Component
+ {favorite.componentType.charAt(0).toUpperCase() +
+ favorite.componentType.slice(1)}{" "}
+ Component
Added {new Date(favorite.addedAt).toLocaleDateString()}
@@ -1011,91 +1178,146 @@ export default function ComponentPlayground() {
{/* All Variants Showcase */}
- {selectedComponent === 'button' && }
- {selectedComponent === 'card' && }
- {selectedComponent === 'input' && }
+ {selectedComponent === "button" && (
+
+ )}
+ {selectedComponent === "card" && (
+
+ )}
+ {selectedComponent === "input" && (
+
+ )}
- All {selectedComponent.charAt(0).toUpperCase() + selectedComponent.slice(1)} Variants
+ All{" "}
+ {selectedComponent.charAt(0).toUpperCase() +
+ selectedComponent.slice(1)}{" "}
+ Variants
- {Object.entries(componentVariants[selectedComponent] || {}).map(([key, variant]) => (
-
-
- setSelectedVariant(key)}
- className={`cursor-pointer transition-all ${selectedVariant === key ? 'ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-gray-800 rounded-lg' : ''}`}
- >
- {/* Render mini version of each variant */}
- {selectedComponent === 'button' && (
- {
- e.stopPropagation();
- setSelectedVariant(key);
- }}>
- {variant.name.split(' ')[0]}
-
- )}
- {selectedComponent === 'card' && key === 'simple' && (
-
-
-
- )}
- {selectedComponent === 'card' && key === 'feature' && (
-
-
-
- )}
- {selectedComponent === 'card' && key === 'pricing' && (
-
-
-
- )}
- {selectedComponent === 'card' && key === 'user' && (
-
-
-
- )}
- {selectedComponent === 'card' && key === 'data' && (
-
-
-
- )}
- {selectedComponent === 'input' && (
-
+ {Object.entries(componentVariants[selectedComponent] || {}).map(
+ ([key, variant]) => (
+
+
+ setSelectedVariant(key)}
+ className={`cursor-pointer transition-all ${
+ selectedVariant === key
+ ? "ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-gray-800 rounded-lg"
+ : ""
+ }`}
+ >
+ {/* Render mini version of each variant */}
+ {selectedComponent === "button" && (
{ } } : {})}
- />
-
- )}
+ onClick={(e) => {
+ e.stopPropagation();
+ setSelectedVariant(key);
+ }}
+ >
+ {variant.name.split(" ")[0]}
+
+ )}
+ {selectedComponent === "card" && key === "simple" && (
+
+
+
+ )}
+ {selectedComponent === "card" && key === "feature" && (
+
+
+
+ )}
+ {selectedComponent === "card" && key === "pricing" && (
+
+
+
+ )}
+ {selectedComponent === "card" && key === "user" && (
+
+
+
+ )}
+ {selectedComponent === "card" && key === "data" && (
+
+
+
+ )}
+ {selectedComponent === "input" && (
+
+ {} }
+ : {})}
+ />
+
+ )}
+
-
-
-
- {variant.name}
-
- {
- e.stopPropagation();
- toggleFavorite(selectedComponent, key);
- }}
- className={`p-1 rounded-full transition-all hover:scale-110 ${isFavorite(selectedComponent, key)
- ? 'text-pink-500 hover:text-pink-600'
- : 'text-gray-400 hover:text-pink-500'
+
+
+ {variant.name}
+
+ {
+ e.stopPropagation();
+ toggleFavorite(selectedComponent, key);
+ }}
+ className={`p-1 rounded-full transition-all hover:scale-110 ${
+ isFavorite(selectedComponent, key)
+ ? "text-pink-500 hover:text-pink-600"
+ : "text-gray-400 hover:text-pink-500"
}`}
- title={isFavorite(selectedComponent, key) ? 'Remove from favorites' : 'Add to favorites'}
- >
-
-
+ title={
+ isFavorite(selectedComponent, key)
+ ? "Remove from favorites"
+ : "Add to favorites"
+ }
+ >
+
+
+
+
+ Click to customize
+
-
- Click to customize
-
-
- ))}
+ )
+ )}
@@ -1103,30 +1325,34 @@ export default function ComponentPlayground() {
-
- Playground Stats
-
+ Playground Stats
- {Object.keys(componentVariants.button).length}
+
+ {Object.keys(componentVariants.button).length}
+
Button Types
- {Object.keys(componentVariants.card).length}
+
+ {Object.keys(componentVariants.card).length}
+
Card Types
- {Object.keys(componentVariants.input).length}
+
+ {Object.keys(componentVariants.input).length}
+
Input Types
@@ -1141,4 +1367,4 @@ export default function ComponentPlayground() {
);
-}
\ No newline at end of file
+}