Fixed market card design
This commit is contained in:
parent
fe9ce486d4
commit
7f9d28c4e1
4 changed files with 76 additions and 96 deletions
|
|
@ -23,6 +23,7 @@ const buttonVariants = cva(
|
||||||
size: {
|
size: {
|
||||||
default: "h-10 py-2 px-4",
|
default: "h-10 py-2 px-4",
|
||||||
sm: "h-9 px-3 rounded-md",
|
sm: "h-9 px-3 rounded-md",
|
||||||
|
xs: "py-1 px-1 rounded-md",
|
||||||
lg: "h-11 px-8 rounded-md",
|
lg: "h-11 px-8 rounded-md",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const Card = React.forwardRef<
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-col justify-between rounded-lg border bg-card text-card-foreground shadow-sm transition-all hover:shadow-lg",
|
"flex flex-col justify-between rounded-lg border bg-muted text-card-foreground shadow-sm transition-all hover:shadow-lg",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { useContext, useEffect, useRef, useState } from "react";
|
import { useContext, useEffect, useRef, useState } from "react";
|
||||||
import ShadTooltip from "../../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../../components/ShadTooltipComponent";
|
||||||
import IconComponent from "../../../components/genericIconComponent";
|
import IconComponent from "../../../components/genericIconComponent";
|
||||||
import ElementStack from "../../../components/stackedComponents";
|
|
||||||
import { Badge } from "../../../components/ui/badge";
|
import { Badge } from "../../../components/ui/badge";
|
||||||
import { Button } from "../../../components/ui/button";
|
import { Button } from "../../../components/ui/button";
|
||||||
import {
|
import {
|
||||||
|
|
@ -125,9 +124,29 @@ export const MarketCardComponent = ({ data }: { data: storeComponent }) => {
|
||||||
<span className="flex w-full items-center gap-2 word-break-break-word">
|
<span className="flex w-full items-center gap-2 word-break-break-word">
|
||||||
{data.name}
|
{data.name}
|
||||||
</span>
|
</span>
|
||||||
<Badge size="sm" variant="gray">
|
<div className="flex gap-3">
|
||||||
Free
|
<ShadTooltip content="Components">
|
||||||
</Badge>
|
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
|
<IconComponent name="ToyBrick" className="h-4 w-4" />
|
||||||
|
{totalComponentsMetadata()}
|
||||||
|
</span>
|
||||||
|
</ShadTooltip>
|
||||||
|
<ShadTooltip content="Likes">
|
||||||
|
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
|
<IconComponent
|
||||||
|
name="Heart"
|
||||||
|
className={classNames("h-4 w-4 ")}
|
||||||
|
/>
|
||||||
|
{likes_count ?? 0}
|
||||||
|
</span>
|
||||||
|
</ShadTooltip>
|
||||||
|
<ShadTooltip content="Downloads">
|
||||||
|
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
|
<IconComponent name="DownloadCloud" className="h-4 w-4" />
|
||||||
|
{data.downloads_count}
|
||||||
|
</span>
|
||||||
|
</ShadTooltip>
|
||||||
|
</div>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
</div>
|
</div>
|
||||||
<CardDescription className="pb-2 pt-2">
|
<CardDescription className="pb-2 pt-2">
|
||||||
|
|
@ -139,103 +158,63 @@ export const MarketCardComponent = ({ data }: { data: storeComponent }) => {
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<div className="flex w-full items-center justify-between gap-2">
|
<div className="flex w-full items-center justify-between gap-2">
|
||||||
<div className="flex w-full flex-wrap items-end justify-between gap-2">
|
<div className="flex w-full flex-wrap items-end justify-between gap-2">
|
||||||
<div className=" flex items-center gap-3">
|
<div className="flex w-full flex-1 flex-wrap gap-2">
|
||||||
<ShadTooltip
|
{data.tags.length > 0 &&
|
||||||
styleClasses="bg-transparent border-none shadow-none"
|
data.tags.map((tag, index) => (
|
||||||
side="right"
|
<Badge
|
||||||
content={
|
key={index}
|
||||||
<div className="flex flex-wrap gap-1">
|
size="md"
|
||||||
{data.tags
|
className="bg-card"
|
||||||
.sort((a, b) => a.name.length - b.name.length)
|
variant="outline"
|
||||||
.map((tag, index) => (
|
>
|
||||||
<div className="">
|
{tag.name}
|
||||||
<Badge
|
</Badge>
|
||||||
key={index}
|
))}
|
||||||
className="bg-card shadow-md"
|
</div>
|
||||||
size="sm"
|
<div className="flex gap-0.5">
|
||||||
variant="outline"
|
<ShadTooltip content="Like">
|
||||||
>
|
<Button
|
||||||
{tag.name}
|
variant="ghost"
|
||||||
</Badge>
|
size="xs"
|
||||||
</div>
|
className="whitespace-nowrap"
|
||||||
))}
|
onClick={() => {
|
||||||
</div>
|
handleLike();
|
||||||
}
|
}}
|
||||||
>
|
|
||||||
<div className="pr-2 hover:opacity-40">
|
|
||||||
{data.tags.length > 0 ? (
|
|
||||||
<ElementStack>
|
|
||||||
{data.tags.map((tag, index) => (
|
|
||||||
<Badge
|
|
||||||
key={index}
|
|
||||||
size="md"
|
|
||||||
className="bg-card"
|
|
||||||
variant="outline"
|
|
||||||
>
|
|
||||||
{tag.name}
|
|
||||||
</Badge>
|
|
||||||
))}
|
|
||||||
</ElementStack>
|
|
||||||
) : (
|
|
||||||
<Badge size="md" variant="outline">
|
|
||||||
-
|
|
||||||
</Badge>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</ShadTooltip>
|
|
||||||
<ShadTooltip content="Components">
|
|
||||||
<span className="flex items-center gap-1.5 text-xs text-foreground">
|
|
||||||
<IconComponent name="ToyBrick" className="h-4 w-4" />
|
|
||||||
{totalComponentsMetadata()}
|
|
||||||
</span>
|
|
||||||
</ShadTooltip>
|
|
||||||
<ShadTooltip content="Favorites">
|
|
||||||
<button
|
|
||||||
onClick={handleLike}
|
|
||||||
className="flex items-center gap-1.5 text-xs text-foreground"
|
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Heart"
|
name="Heart"
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"h-4 w-4 ",
|
"h-6 w-6 p-0.5",
|
||||||
liked_by_user ? "fill-destructive stroke-destructive" : ""
|
liked_by_user ? "fill-destructive stroke-destructive" : ""
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{likes_count ?? 0}
|
</Button>
|
||||||
</button>
|
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
<ShadTooltip content="Downloads">
|
<ShadTooltip content="Add to Account">
|
||||||
<span className="flex items-center gap-1.5 text-xs text-foreground">
|
<Button
|
||||||
<IconComponent name="DownloadCloud" className="h-4 w-4" />
|
variant="ghost"
|
||||||
{data.downloads_count}
|
size="xs"
|
||||||
</span>
|
className="whitespace-nowrap"
|
||||||
|
onClick={() => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!added) {
|
||||||
|
handleAdd();
|
||||||
|
} else {
|
||||||
|
handleInstall();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconComponent
|
||||||
|
name={
|
||||||
|
loading ? "Loader2" : added ? "GitBranchPlus" : "Plus"
|
||||||
|
}
|
||||||
|
className={"h-6 w-6" + (loading ? " animate-spin" : "")}
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
className="whitespace-nowrap "
|
|
||||||
onClick={() => {
|
|
||||||
if (loading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!added) {
|
|
||||||
handleAdd();
|
|
||||||
} else {
|
|
||||||
handleInstall();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconComponent
|
|
||||||
name={
|
|
||||||
loading ? "Loader2" : added ? "GitBranchPlus" : "BookmarkPlus"
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
"main-page-nav-button" + (loading ? " animate-spin" : "")
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{added ? "Use Template" : "Add to Account"}
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
|
|
|
||||||
|
|
@ -205,15 +205,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-page-panel {
|
.loading-page-panel {
|
||||||
@apply flex h-full w-full items-center justify-center bg-muted;
|
@apply flex h-full w-full items-center justify-center bg-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-page-panel {
|
.main-page-panel {
|
||||||
@apply flex-max-width h-full flex-col overflow-auto bg-muted px-16;
|
@apply flex-max-width h-full flex-col overflow-auto bg-background px-16;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-page-panel {
|
.admin-page-panel {
|
||||||
@apply flex-max-width h-full flex-col overflow-auto bg-muted px-16;
|
@apply flex-max-width h-full flex-col overflow-auto bg-background px-16;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-page-nav-arrangement {
|
.main-page-nav-arrangement {
|
||||||
|
|
@ -241,7 +241,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.community-page-arrangement {
|
.community-page-arrangement {
|
||||||
@apply flex-max-width h-full flex-col overflow-auto bg-muted px-16;
|
@apply flex-max-width h-full flex-col overflow-auto bg-background px-16;
|
||||||
}
|
}
|
||||||
|
|
||||||
.community-page-nav-arrangement {
|
.community-page-nav-arrangement {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue