negodesign 0.0.55 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/banner/AdCardBanner.svelte +74 -74
- package/dist/components/core/banner/CtaCardBanner.svelte +118 -118
- package/dist/components/core/breadcrumb/breadcrumb-list.svelte +31 -31
- package/dist/components/core/button/ButtonBack.svelte +18 -18
- package/dist/components/core/button/ButtonLogin.svelte +15 -15
- package/dist/components/core/button/ButtonLoginWith.svelte +57 -57
- package/dist/components/core/button/ButtonSend.svelte +15 -15
- package/dist/components/core/card/highlight/01/CardHighlight01.svelte +103 -103
- package/dist/components/core/card/highlight/02/CardHighlight02.svelte +99 -99
- package/dist/components/core/card/highlight/CardHighlight.svelte +22 -22
- package/dist/components/core/card/media/01/CardMedia01.svelte +133 -133
- package/dist/components/core/card/media/02/CardMedia02.svelte +127 -127
- package/dist/components/core/card/media/CardMedia.svelte +18 -18
- package/dist/components/core/card/product/01/CardProduct01.svelte +136 -136
- package/dist/components/core/card/product/02/CardProduct02.svelte +124 -124
- package/dist/components/core/card/product/CardProduct.svelte +22 -22
- package/dist/components/core/card/profile/01/CardProfile01.svelte +134 -134
- package/dist/components/core/card/profile/02/CardProfile02.svelte +132 -132
- package/dist/components/core/card/profile/CardProfile.svelte +18 -18
- package/dist/components/core/card/promotion/CardPromotion.svelte +139 -139
- package/dist/components/core/card/promotion/CardPromotionPrice.svelte +32 -32
- package/dist/components/core/card/shared/CardButton.svelte +42 -42
- package/dist/components/core/card/shared/CardCart.svelte +36 -36
- package/dist/components/core/card/shared/CardDescription.svelte +41 -41
- package/dist/components/core/card/shared/CardFavorite.svelte +33 -33
- package/dist/components/core/card/shared/CardLogo.svelte +19 -19
- package/dist/components/core/card/shared/CardPhoneOrWhatsapp.svelte +45 -45
- package/dist/components/core/card/shared/CardStarRating.svelte +24 -24
- package/dist/components/core/card/shared/CardTags.svelte +95 -95
- package/dist/components/core/card/shared/CardThumbnailVideo.svelte +232 -232
- package/dist/components/core/card/shared/CardTitlePrice.svelte +24 -24
- package/dist/components/core/card/shared/TruncatableText.svelte +49 -49
- package/dist/components/core/card/types.d.ts +4 -0
- package/dist/components/core/carousel/badge/type.d.ts +27 -0
- package/dist/components/core/carousel/badge/ui/CarouselBadge.svelte +109 -109
- package/dist/components/core/carousel/grid/media/types.d.ts +3 -0
- package/dist/components/core/carousel/grid/media/ui/CarouselGridMedia.svelte +2 -1
- package/dist/components/core/carousel/grid/product/types.d.ts +8 -0
- package/dist/components/core/carousel/grid/product/ui/CarouselGridProduct.svelte +14 -4
- package/dist/components/core/carousel/grid/profile/ui/CarouselGridProfile.svelte +1 -1
- package/dist/components/core/carousel/grid/promotion/ui/CarouselGridPromotion.svelte +1 -1
- package/dist/components/core/carousel/grid/shared/ui/CarouselGridSlot.svelte +8 -3
- package/dist/components/core/carousel/grid/shared/ui/CarouselGridSlot.svelte.d.ts +2 -1
- package/dist/components/core/carousel/hero/types.d.ts +30 -0
- package/dist/components/core/carousel/hero/{CarouselHero.svelte → ui/CarouselHero.svelte} +163 -161
- package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte +60 -60
- package/dist/components/core/carousel/types.d.ts +2 -56
- package/dist/components/core/datatable/ui/DataTableActions.svelte +28 -28
- package/dist/components/core/datatable/ui/DataTableCheckbox.svelte +22 -22
- package/dist/components/core/datatable/ui/DataTableContent.svelte +59 -59
- package/dist/components/core/datatable/ui/DataTableCore.svelte +151 -151
- package/dist/components/core/datatable/ui/DataTableDragHandle.svelte +8 -8
- package/dist/components/core/datatable/ui/DataTableListFilter.svelte +59 -59
- package/dist/components/core/datatable/ui/DataTableListPagination.svelte +35 -35
- package/dist/components/core/footer/ui/Footer.svelte +18 -18
- package/dist/components/core/form/ui/input-base.svelte +81 -81
- package/dist/components/core/form/ui/input-email-or-phone.svelte +23 -23
- package/dist/components/core/form/ui/input-email.svelte +23 -23
- package/dist/components/core/form/ui/input-password-confirm.svelte +23 -23
- package/dist/components/core/form/ui/input-password.svelte +23 -23
- package/dist/components/core/form/ui/input-phone.svelte +33 -33
- package/dist/components/core/form/ui/input-username.svelte +22 -22
- package/dist/components/core/grid/data/types.d.ts +16 -0
- package/dist/components/core/grid/ui/01/Grid01.svelte +27 -0
- package/dist/components/core/grid/ui/01/Grid01.svelte.d.ts +4 -0
- package/dist/components/core/grid/ui/02/Grid02.svelte +27 -0
- package/dist/components/core/grid/ui/02/Grid02.svelte.d.ts +4 -0
- package/dist/components/core/grid/ui/PanelGrid.svelte +27 -0
- package/dist/components/core/grid/ui/PanelGrid.svelte.d.ts +4 -0
- package/dist/components/core/grid/ui/SimpleGrid.svelte +35 -0
- package/dist/components/core/grid/ui/SimpleGrid.svelte.d.ts +4 -0
- package/dist/components/core/grid/ui/shared/DescriptionGrid.svelte +17 -0
- package/dist/components/core/grid/ui/shared/DescriptionGrid.svelte.d.ts +7 -0
- package/dist/components/core/grid/ui/shared/IconRenderGrid.svelte +16 -0
- package/dist/components/core/grid/ui/shared/IconRenderGrid.svelte.d.ts +7 -0
- package/dist/components/core/grid/ui/shared/TitleGrid.svelte +11 -0
- package/dist/components/core/grid/ui/shared/TitleGrid.svelte.d.ts +7 -0
- package/dist/components/core/hero/SimpleHero.svelte +65 -65
- package/dist/components/core/label/LabelOr.svelte +25 -25
- package/dist/components/core/link/link-forget-password.svelte +12 -12
- package/dist/components/core/link/link-privacy-polity.svelte +12 -12
- package/dist/components/core/link/link-terms-of-service.svelte +12 -12
- package/dist/components/core/nav/data/complex-menu-utils.d.ts +7 -0
- package/dist/components/core/nav/data/complex-menu-utils.js +15 -0
- package/dist/components/core/nav/data/nav-menu.d.ts +21 -7
- package/dist/components/core/nav/{ui/shared → data}/types.d.ts +15 -2
- package/dist/components/core/nav/ui/ComplexMenu.svelte +36 -0
- package/dist/components/core/nav/ui/ComplexMenu.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/Menu.svelte +70 -66
- package/dist/components/core/nav/ui/Menu.svelte.d.ts +1 -1
- package/dist/components/core/nav/ui/SimpleMenu.svelte +14 -0
- package/dist/components/core/nav/ui/SimpleMenu.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/mobile/ComplexMenuMobile.svelte +98 -0
- package/dist/components/core/nav/ui/mobile/ComplexMenuMobile.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/mobile/MenuMobile.svelte +54 -0
- package/dist/components/core/nav/ui/mobile/MenuMobile.svelte.d.ts +11 -0
- package/dist/components/core/nav/ui/mobile/SimpleMenuMobile.svelte +42 -0
- package/dist/components/core/nav/ui/mobile/{nav-menu-drawer.svelte.d.ts → SimpleMenuMobile.svelte.d.ts} +3 -3
- package/dist/components/core/nav/ui/shared/CollapsibleNavMenu.svelte +24 -0
- package/dist/components/core/nav/ui/shared/CollapsibleNavMenu.svelte.d.ts +8 -0
- package/dist/components/core/nav/ui/shared/MenuButton.svelte +51 -0
- package/dist/components/core/nav/ui/shared/MenuButton.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/MenuLinks.svelte +40 -40
- package/dist/components/core/nav/ui/shared/MenuListItem.svelte +48 -48
- package/dist/components/core/nav/ui/shared/MenuListItem.svelte.d.ts +1 -1
- package/dist/components/core/nav/ui/shared/MenuLogo.svelte +13 -0
- package/dist/components/core/nav/ui/shared/MenuLogo.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/NavMenuItem.svelte +28 -0
- package/dist/components/core/nav/ui/shared/NavMenuItem.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownMenuListItem.svelte +40 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownMenuListItem.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItem.svelte +12 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItem.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItemCard.svelte +49 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItemCard.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItemGrid.svelte +30 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItemGrid.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItemList.svelte +24 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItemList.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItems.svelte +24 -0
- package/dist/components/core/nav/ui/shared/dropdown/DropdownNavigationMenuItems.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/shared/{NavigationMenuItem.svelte → navigation/NavigationMenuItem.svelte} +15 -15
- package/dist/components/core/nav/ui/shared/{NavigationMenuItem.svelte.d.ts → navigation/NavigationMenuItem.svelte.d.ts} +1 -1
- package/dist/components/core/nav/ui/shared/{NavigationMenuItemCard.svelte → navigation/NavigationMenuItemCard.svelte} +62 -62
- package/dist/components/core/nav/ui/shared/{NavigationMenuItemCard.svelte.d.ts → navigation/NavigationMenuItemCard.svelte.d.ts} +1 -1
- package/dist/components/core/nav/ui/shared/{NavigationMenuItemGrid.svelte → navigation/NavigationMenuItemGrid.svelte} +32 -32
- package/dist/components/core/nav/ui/shared/{NavigationMenuItemGrid.svelte.d.ts → navigation/NavigationMenuItemGrid.svelte.d.ts} +1 -1
- package/dist/components/core/nav/ui/shared/{NavigationMenuItemList.svelte → navigation/NavigationMenuItemList.svelte} +24 -24
- package/dist/components/core/nav/ui/shared/{NavigationMenuItemList.svelte.d.ts → navigation/NavigationMenuItemList.svelte.d.ts} +1 -1
- package/dist/components/core/nav/ui/shared/{NavigationMenuItems.svelte → navigation/NavigationMenuItems.svelte} +21 -21
- package/dist/components/core/nav/ui/shared/{NavigationMenuItems.svelte.d.ts → navigation/NavigationMenuItems.svelte.d.ts} +1 -1
- package/dist/components/core/panel/CarouselSlot.svelte +57 -57
- package/dist/components/core/panel/LeftHero.svelte +117 -117
- package/dist/components/core/search/SearchInput.svelte +32 -32
- package/dist/components/core/search/shared/SearchInputCore.svelte +66 -66
- package/dist/components/core/sidebar/MenuBarSidebar.svelte +70 -70
- package/dist/components/core/sidebar/MenuBarSidebar.svelte.d.ts +2 -2
- package/dist/components/core/sidebar/data/nav-menu-sidebar.js +1 -0
- package/dist/components/core/sidebar/data/nav-top-bar-sidebar.js +1 -0
- package/dist/components/core/sidebar/data/nav-user-sidebar.js +1 -0
- package/dist/components/core/sidebar/types.d.ts +2 -2
- package/dist/components/core/sidebar/ui/navbar/NavMenuBarSidebar.svelte +97 -97
- package/dist/components/core/sidebar/ui/navbar/NavMenuBarSidebar.svelte.d.ts +1 -1
- package/dist/components/core/sidebar/ui/navbar/NavMenuBottomSidebar.svelte +33 -33
- package/dist/components/core/sidebar/ui/navbar/NavMenuBottomSidebar.svelte.d.ts +1 -1
- package/dist/components/core/sidebar/ui/navbar/NavMenuTopBarSidebar.svelte +103 -103
- package/dist/components/core/sidebar/ui/navbar/NavMenuTopBarSidebar.svelte.d.ts +1 -1
- package/dist/components/core/tabs/ui/tab-underline.svelte +43 -43
- package/dist/components/pages/admin/01/ui/AdminContent.svelte +14 -14
- package/dist/components/pages/admin/01/ui/AdminPanel.svelte +46 -46
- package/dist/components/pages/privacy-policy-or-terms-of-use/types.d.ts +2 -0
- package/dist/components/pages/security/login/01/ui/FormRegister.svelte +28 -28
- package/dist/components/pages/security/login/01/ui/LoginCard.svelte +107 -107
- package/dist/components/pages/security/login/PageLogin.svelte +22 -22
- package/dist/components/ui/badge/badge.svelte +49 -49
- package/dist/components/ui/button/button.svelte +82 -82
- package/dist/components/ui/chart/chart-container.svelte +80 -80
- package/dist/components/ui/chart/chart-style.svelte +37 -37
- package/dist/components/ui/chart/chart-tooltip.svelte +184 -184
- package/dist/components/ui/checkbox/checkbox.svelte +40 -40
- package/dist/components/ui/data-table/flex-render.svelte +40 -40
- package/dist/components/ui/drawer/drawer-close.svelte +7 -7
- package/dist/components/ui/drawer/drawer-content.svelte +33 -33
- package/dist/components/ui/drawer/drawer-description.svelte +17 -17
- package/dist/components/ui/drawer/drawer-footer.svelte +20 -20
- package/dist/components/ui/drawer/drawer-header.svelte +20 -20
- package/dist/components/ui/drawer/drawer-nested.svelte +12 -12
- package/dist/components/ui/drawer/drawer-overlay.svelte +17 -17
- package/dist/components/ui/drawer/drawer-portal.svelte +7 -7
- package/dist/components/ui/drawer/drawer-title.svelte +17 -17
- package/dist/components/ui/drawer/drawer-trigger.svelte +7 -7
- package/dist/components/ui/drawer/drawer.svelte +12 -12
- package/dist/components/ui/select/select-content.svelte +45 -45
- package/dist/components/ui/select/select-group-heading.svelte +21 -21
- package/dist/components/ui/select/select-group.svelte +17 -17
- package/dist/components/ui/select/select-item.svelte +41 -41
- package/dist/components/ui/select/select-label.svelte +20 -20
- package/dist/components/ui/select/select-portal.svelte +7 -7
- package/dist/components/ui/select/select-scroll-down-button.svelte +21 -21
- package/dist/components/ui/select/select-scroll-up-button.svelte +21 -21
- package/dist/components/ui/select/select-separator.svelte +18 -18
- package/dist/components/ui/select/select-trigger.svelte +30 -30
- package/dist/components/ui/select/select.svelte +11 -11
- package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +39 -39
- package/dist/components/ui/star-rating/star-rating-star.svelte +41 -41
- package/dist/components/ui/star-rating/star-rating.svelte +20 -20
- package/dist/components/ui/table/table-body.svelte +15 -15
- package/dist/components/ui/table/table-caption.svelte +20 -20
- package/dist/components/ui/table/table-cell.svelte +15 -15
- package/dist/components/ui/table/table-footer.svelte +20 -20
- package/dist/components/ui/table/table-head.svelte +15 -15
- package/dist/components/ui/table/table-header.svelte +20 -20
- package/dist/components/ui/table/table-row.svelte +15 -15
- package/dist/components/ui/table/table.svelte +17 -17
- package/dist/components/ui/tabs/tabs-content.svelte +17 -17
- package/dist/components/ui/tabs/tabs-list.svelte +40 -40
- package/dist/components/ui/tabs/tabs-trigger.svelte +23 -23
- package/dist/components/ui/tabs/tabs.svelte +19 -19
- package/dist/globals.css +56 -2
- package/dist/index.d.ts +1 -8
- package/dist/index.js +1 -8
- package/dist/styles/globals.css +149 -149
- package/dist/styles/hgi-stroke-rounded.css +1 -1
- package/dist/types/index.d.ts +9 -7
- package/package.json +113 -113
- package/dist/components/core/nav/ui/NavMenu.svelte +0 -122
- package/dist/components/core/nav/ui/NavMenu.svelte.d.ts +0 -4
- package/dist/components/core/nav/ui/mobile/nav-menu-drawer.svelte +0 -85
- package/dist/components/core/{nav/data/nav-menu-sidebar.js → carousel/badge/type.js} +0 -0
- package/dist/components/core/{nav/ui/shared → carousel/hero}/types.js +0 -0
- package/dist/components/core/carousel/hero/{CarouselHero.svelte.d.ts → ui/CarouselHero.svelte.d.ts} +1 -1
- /package/dist/components/core/{nav/data/nav-top-bar-sidebar.js → grid/data/types.js} +0 -0
- /package/dist/components/core/nav/data/{nav-user-sidebar.js → types.js} +0 -0
- /package/dist/components/core/{nav → sidebar}/data/nav-menu-sidebar.d.ts +0 -0
- /package/dist/components/core/{nav → sidebar}/data/nav-top-bar-sidebar.d.ts +0 -0
- /package/dist/components/core/{nav → sidebar}/data/nav-user-sidebar.d.ts +0 -0
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Button from "../../../ui/button/button.svelte";
|
|
3
|
-
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
-
import { t } from "../../../../i18n";
|
|
5
|
-
import CardCart from "../shared/CardCart.svelte";
|
|
6
|
-
import CardDescription from "../shared/CardDescription.svelte";
|
|
7
|
-
import CardFavorite from "../shared/CardFavorite.svelte";
|
|
8
|
-
import CardStartPrice from "./CardPromotionPrice.svelte";
|
|
9
|
-
import CardTags from "../shared/CardTags.svelte";
|
|
10
|
-
import ImgPlaceHolderGallery from "../../../../assets/placeholder-image.png";
|
|
11
|
-
import ImgPlaceholderCompany from "../../../../assets/placeholder-company.png";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Card component with a title and content.
|
|
15
|
-
* @component
|
|
16
|
-
*/
|
|
17
|
-
import type { CardPromotionProps } from "../types";
|
|
18
|
-
|
|
19
|
-
let {
|
|
20
|
-
id,
|
|
21
|
-
tags,
|
|
22
|
-
logo,
|
|
23
|
-
title,
|
|
24
|
-
imageUrl,
|
|
25
|
-
isFavorite = false,
|
|
26
|
-
isCart = false,
|
|
27
|
-
isLoading = false,
|
|
28
|
-
newPrice,
|
|
29
|
-
oldPrice,
|
|
30
|
-
content,
|
|
31
|
-
buttonBuyText,
|
|
32
|
-
buttonBuyClass,
|
|
33
|
-
isDescriptionIcon,
|
|
34
|
-
isDescriptionLabel,
|
|
35
|
-
onClickBuy,
|
|
36
|
-
onClickShop,
|
|
37
|
-
onClickFavorite,
|
|
38
|
-
}: CardPromotionProps = $props();
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<article class="relative rounded-lg border">
|
|
42
|
-
<aside class="relative w-full">
|
|
43
|
-
<div class="absolute top-1 left-1 z-2 gap-1 p-2">
|
|
44
|
-
{#if isLoading}
|
|
45
|
-
<Skeleton class="h-5 w-20 rounded-full bg-black/20" />
|
|
46
|
-
{:else if logo}
|
|
47
|
-
<img
|
|
48
|
-
src={logo}
|
|
49
|
-
width={30}
|
|
50
|
-
height={30}
|
|
51
|
-
alt={title}
|
|
52
|
-
onerror={(e) =>
|
|
53
|
-
((e.target as HTMLImageElement).src = ImgPlaceholderCompany)}
|
|
54
|
-
class="rounded-lg"
|
|
55
|
-
/>
|
|
56
|
-
{:else}
|
|
57
|
-
<img
|
|
58
|
-
src={ImgPlaceholderCompany}
|
|
59
|
-
width={30}
|
|
60
|
-
height={30}
|
|
61
|
-
alt={title}
|
|
62
|
-
class="rounded-lg"
|
|
63
|
-
/>
|
|
64
|
-
{/if}
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div class="absolute top-1 right-1 z-2 flex items-center gap-1 p-2">
|
|
68
|
-
<CardFavorite
|
|
69
|
-
{id}
|
|
70
|
-
{isFavorite}
|
|
71
|
-
{isLoading}
|
|
72
|
-
onFavoriteClick={onClickFavorite}
|
|
73
|
-
/>
|
|
74
|
-
<CardCart {id} {isCart} {isLoading} onCartClick={onClickShop} />
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
{#if isLoading}
|
|
78
|
-
<Skeleton
|
|
79
|
-
class="rounded-lg h-30 w-full object-cover object-center bg-black/15"
|
|
80
|
-
/>
|
|
81
|
-
{:else if imageUrl}
|
|
82
|
-
<img
|
|
83
|
-
src={imageUrl}
|
|
84
|
-
alt={imageUrl}
|
|
85
|
-
class="rounded-tr-lg rounded-tl-lg h-36 w-full object-cover object-center"
|
|
86
|
-
onerror={(e) =>
|
|
87
|
-
((e.target as HTMLImageElement).src = ImgPlaceHolderGallery)}
|
|
88
|
-
/>
|
|
89
|
-
{/if}
|
|
90
|
-
<div class="absolute inset-0 bg-black/5 rounded-sm h-full w-full"></div>
|
|
91
|
-
</aside>
|
|
92
|
-
|
|
93
|
-
<aside
|
|
94
|
-
class="bottom-1 inset-x-0 flex flex-col items-center justify-center gap-0.5 m-auto max-w-11/12 p-1 rounded-md"
|
|
95
|
-
>
|
|
96
|
-
<div class="flex justify-between w-full items-center mb-1">
|
|
97
|
-
{#if title}
|
|
98
|
-
{#if isLoading}
|
|
99
|
-
<Skeleton class="h-4 w-30 rounded-lg" />
|
|
100
|
-
{:else}
|
|
101
|
-
<div class="font-semibold line-clamp-1 flex-nowrap">
|
|
102
|
-
{title}
|
|
103
|
-
</div>
|
|
104
|
-
{/if}
|
|
105
|
-
{/if}
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<div>
|
|
109
|
-
<CardDescription {content} {isDescriptionIcon} {isDescriptionLabel} />
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
{#if tags && tags.length > 0}
|
|
113
|
-
<div class="w-full mb-2">
|
|
114
|
-
<CardTags {tags} />
|
|
115
|
-
</div>
|
|
116
|
-
{/if}
|
|
117
|
-
|
|
118
|
-
<div class="flex justify-start gap-2 w-full">
|
|
119
|
-
{#if isLoading}
|
|
120
|
-
<Skeleton class="h-5 bg-black/10 w-25 my-2 mr-2" />
|
|
121
|
-
{:else if newPrice || oldPrice}
|
|
122
|
-
<div>
|
|
123
|
-
<CardStartPrice {newPrice} {oldPrice} />
|
|
124
|
-
</div>
|
|
125
|
-
{/if}
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
{#if isLoading}
|
|
129
|
-
<Skeleton class="h-9 w-full rounded-md" />
|
|
130
|
-
{:else}
|
|
131
|
-
<Button
|
|
132
|
-
onclick={() => onClickBuy!(id)}
|
|
133
|
-
class="w-full bottom-0 bg-gradient {buttonBuyClass}"
|
|
134
|
-
>
|
|
135
|
-
{buttonBuyText || $t("label.buy")}
|
|
136
|
-
</Button>
|
|
137
|
-
{/if}
|
|
138
|
-
</aside>
|
|
139
|
-
</article>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from "../../../ui/button/button.svelte";
|
|
3
|
+
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
+
import { t } from "../../../../i18n";
|
|
5
|
+
import CardCart from "../shared/CardCart.svelte";
|
|
6
|
+
import CardDescription from "../shared/CardDescription.svelte";
|
|
7
|
+
import CardFavorite from "../shared/CardFavorite.svelte";
|
|
8
|
+
import CardStartPrice from "./CardPromotionPrice.svelte";
|
|
9
|
+
import CardTags from "../shared/CardTags.svelte";
|
|
10
|
+
import ImgPlaceHolderGallery from "../../../../assets/placeholder-image.png";
|
|
11
|
+
import ImgPlaceholderCompany from "../../../../assets/placeholder-company.png";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Card component with a title and content.
|
|
15
|
+
* @component
|
|
16
|
+
*/
|
|
17
|
+
import type { CardPromotionProps } from "../types";
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
id,
|
|
21
|
+
tags,
|
|
22
|
+
logo,
|
|
23
|
+
title,
|
|
24
|
+
imageUrl,
|
|
25
|
+
isFavorite = false,
|
|
26
|
+
isCart = false,
|
|
27
|
+
isLoading = false,
|
|
28
|
+
newPrice,
|
|
29
|
+
oldPrice,
|
|
30
|
+
content,
|
|
31
|
+
buttonBuyText,
|
|
32
|
+
buttonBuyClass,
|
|
33
|
+
isDescriptionIcon,
|
|
34
|
+
isDescriptionLabel,
|
|
35
|
+
onClickBuy,
|
|
36
|
+
onClickShop,
|
|
37
|
+
onClickFavorite,
|
|
38
|
+
}: CardPromotionProps = $props();
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<article class="relative rounded-lg border">
|
|
42
|
+
<aside class="relative w-full">
|
|
43
|
+
<div class="absolute top-1 left-1 z-2 gap-1 p-2">
|
|
44
|
+
{#if isLoading}
|
|
45
|
+
<Skeleton class="h-5 w-20 rounded-full bg-black/20" />
|
|
46
|
+
{:else if logo}
|
|
47
|
+
<img
|
|
48
|
+
src={logo}
|
|
49
|
+
width={30}
|
|
50
|
+
height={30}
|
|
51
|
+
alt={title}
|
|
52
|
+
onerror={(e) =>
|
|
53
|
+
((e.target as HTMLImageElement).src = ImgPlaceholderCompany)}
|
|
54
|
+
class="rounded-lg"
|
|
55
|
+
/>
|
|
56
|
+
{:else}
|
|
57
|
+
<img
|
|
58
|
+
src={ImgPlaceholderCompany}
|
|
59
|
+
width={30}
|
|
60
|
+
height={30}
|
|
61
|
+
alt={title}
|
|
62
|
+
class="rounded-lg"
|
|
63
|
+
/>
|
|
64
|
+
{/if}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="absolute top-1 right-1 z-2 flex items-center gap-1 p-2">
|
|
68
|
+
<CardFavorite
|
|
69
|
+
{id}
|
|
70
|
+
{isFavorite}
|
|
71
|
+
{isLoading}
|
|
72
|
+
onFavoriteClick={onClickFavorite}
|
|
73
|
+
/>
|
|
74
|
+
<CardCart {id} {isCart} {isLoading} onCartClick={onClickShop} />
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
{#if isLoading}
|
|
78
|
+
<Skeleton
|
|
79
|
+
class="rounded-lg h-30 w-full object-cover object-center bg-black/15"
|
|
80
|
+
/>
|
|
81
|
+
{:else if imageUrl}
|
|
82
|
+
<img
|
|
83
|
+
src={imageUrl}
|
|
84
|
+
alt={imageUrl}
|
|
85
|
+
class="rounded-tr-lg rounded-tl-lg h-36 w-full object-cover object-center"
|
|
86
|
+
onerror={(e) =>
|
|
87
|
+
((e.target as HTMLImageElement).src = ImgPlaceHolderGallery)}
|
|
88
|
+
/>
|
|
89
|
+
{/if}
|
|
90
|
+
<div class="absolute inset-0 bg-black/5 rounded-sm h-full w-full"></div>
|
|
91
|
+
</aside>
|
|
92
|
+
|
|
93
|
+
<aside
|
|
94
|
+
class="bottom-1 inset-x-0 flex flex-col items-center justify-center gap-0.5 m-auto max-w-11/12 p-1 rounded-md"
|
|
95
|
+
>
|
|
96
|
+
<div class="flex justify-between w-full items-center mb-1">
|
|
97
|
+
{#if title}
|
|
98
|
+
{#if isLoading}
|
|
99
|
+
<Skeleton class="h-4 w-30 rounded-lg" />
|
|
100
|
+
{:else}
|
|
101
|
+
<div class="font-semibold line-clamp-1 flex-nowrap">
|
|
102
|
+
{title}
|
|
103
|
+
</div>
|
|
104
|
+
{/if}
|
|
105
|
+
{/if}
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div>
|
|
109
|
+
<CardDescription {content} {isDescriptionIcon} {isDescriptionLabel} />
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
{#if tags && tags.length > 0}
|
|
113
|
+
<div class="w-full mb-2">
|
|
114
|
+
<CardTags {tags} />
|
|
115
|
+
</div>
|
|
116
|
+
{/if}
|
|
117
|
+
|
|
118
|
+
<div class="flex justify-start gap-2 w-full">
|
|
119
|
+
{#if isLoading}
|
|
120
|
+
<Skeleton class="h-5 bg-black/10 w-25 my-2 mr-2" />
|
|
121
|
+
{:else if newPrice || oldPrice}
|
|
122
|
+
<div>
|
|
123
|
+
<CardStartPrice {newPrice} {oldPrice} />
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{#if isLoading}
|
|
129
|
+
<Skeleton class="h-9 w-full rounded-md" />
|
|
130
|
+
{:else}
|
|
131
|
+
<Button
|
|
132
|
+
onclick={() => onClickBuy!(id)}
|
|
133
|
+
class="w-full bottom-0 bg-gradient {buttonBuyClass}"
|
|
134
|
+
>
|
|
135
|
+
{buttonBuyText || $t("label.buy")}
|
|
136
|
+
</Button>
|
|
137
|
+
{/if}
|
|
138
|
+
</aside>
|
|
139
|
+
</article>
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import StartBg from "../../../../assets/start.png";
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
newPrice?: string | number;
|
|
6
|
-
oldPrice?: string | number;
|
|
7
|
-
type?: "start" | "normal";
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let { newPrice, oldPrice, type = "normal" }: Props = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<div class="relative min-w-25 md:min-w-32 ml-0 pl-0">
|
|
14
|
-
{#if type == "start"}
|
|
15
|
-
<img
|
|
16
|
-
src={StartBg}
|
|
17
|
-
alt=""
|
|
18
|
-
class="shadow rounded-tl-lg rounded-bl-lg md:w-20 md:h-20 lg:w-32 lg:h-24 absolute"
|
|
19
|
-
/>
|
|
20
|
-
{/if}
|
|
21
|
-
{#if newPrice && oldPrice}
|
|
22
|
-
<div class="z-20 flex justify-start items-center">
|
|
23
|
-
<div class="font-extrabold text-lg">{newPrice}</div>
|
|
24
|
-
<div class="mx-2">/</div>
|
|
25
|
-
<div class="font-semibold line-through text-red-600 text-[10px]">
|
|
26
|
-
{oldPrice}
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
{:else}
|
|
30
|
-
<div class="z-20 font-bold">{newPrice}</div>
|
|
31
|
-
{/if}
|
|
32
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import StartBg from "../../../../assets/start.png";
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
newPrice?: string | number;
|
|
6
|
+
oldPrice?: string | number;
|
|
7
|
+
type?: "start" | "normal";
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let { newPrice, oldPrice, type = "normal" }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class="relative min-w-25 md:min-w-32 ml-0 pl-0">
|
|
14
|
+
{#if type == "start"}
|
|
15
|
+
<img
|
|
16
|
+
src={StartBg}
|
|
17
|
+
alt=""
|
|
18
|
+
class="shadow rounded-tl-lg rounded-bl-lg md:w-20 md:h-20 lg:w-32 lg:h-24 absolute"
|
|
19
|
+
/>
|
|
20
|
+
{/if}
|
|
21
|
+
{#if newPrice && oldPrice}
|
|
22
|
+
<div class="z-20 flex justify-start items-center">
|
|
23
|
+
<div class="font-extrabold text-lg">{newPrice}</div>
|
|
24
|
+
<div class="mx-2">/</div>
|
|
25
|
+
<div class="font-semibold line-through text-red-600 text-[10px]">
|
|
26
|
+
{oldPrice}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
{:else}
|
|
30
|
+
<div class="z-20 font-bold">{newPrice}</div>
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Button } from "../../../ui/button/index.js";
|
|
3
|
-
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
-
import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/svelte";
|
|
5
|
-
|
|
6
|
-
type CardButtonProps = {
|
|
7
|
-
id: string | number;
|
|
8
|
-
icon?: IconSvgElement | string;
|
|
9
|
-
isFlex?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
text: string;
|
|
12
|
-
isLoading?: boolean;
|
|
13
|
-
onClick: (id: string | number) => void;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
let {
|
|
17
|
-
id,
|
|
18
|
-
icon,
|
|
19
|
-
isFlex,
|
|
20
|
-
className,
|
|
21
|
-
text,
|
|
22
|
-
isLoading,
|
|
23
|
-
onClick,
|
|
24
|
-
}: CardButtonProps = $props();
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
{#if isLoading}
|
|
28
|
-
<Skeleton
|
|
29
|
-
class="w-full h-7.5 rounded-lg bg-gray-500/80 dark:bg-gray-500/30"
|
|
30
|
-
/>
|
|
31
|
-
{:else}
|
|
32
|
-
<Button class="bg-gradient flex-1 {className}" onclick={() => onClick(id)}>
|
|
33
|
-
{#if icon}
|
|
34
|
-
{#if typeof icon === "string"}
|
|
35
|
-
<i class={icon}></i>
|
|
36
|
-
{:else}
|
|
37
|
-
<HugeiconsIcon {icon} />
|
|
38
|
-
{/if}
|
|
39
|
-
{/if}
|
|
40
|
-
<span>{text}</span>
|
|
41
|
-
</Button>
|
|
42
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from "../../../ui/button/index.js";
|
|
3
|
+
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
+
import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/svelte";
|
|
5
|
+
|
|
6
|
+
type CardButtonProps = {
|
|
7
|
+
id: string | number;
|
|
8
|
+
icon?: IconSvgElement | string;
|
|
9
|
+
isFlex?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
text: string;
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
onClick: (id: string | number) => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
id,
|
|
18
|
+
icon,
|
|
19
|
+
isFlex,
|
|
20
|
+
className,
|
|
21
|
+
text,
|
|
22
|
+
isLoading,
|
|
23
|
+
onClick,
|
|
24
|
+
}: CardButtonProps = $props();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if isLoading}
|
|
28
|
+
<Skeleton
|
|
29
|
+
class="w-full h-7.5 rounded-lg bg-gray-500/80 dark:bg-gray-500/30"
|
|
30
|
+
/>
|
|
31
|
+
{:else}
|
|
32
|
+
<Button class="bg-gradient flex-1 {className}" onclick={() => onClick(id)}>
|
|
33
|
+
{#if icon}
|
|
34
|
+
{#if typeof icon === "string"}
|
|
35
|
+
<i class={icon}></i>
|
|
36
|
+
{:else}
|
|
37
|
+
<HugeiconsIcon {icon} />
|
|
38
|
+
{/if}
|
|
39
|
+
{/if}
|
|
40
|
+
<span>{text}</span>
|
|
41
|
+
</Button>
|
|
42
|
+
{/if}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Button } from "../../../ui/button/index.js";
|
|
3
|
-
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
-
import {
|
|
5
|
-
ShoppingCartAdd01Icon,
|
|
6
|
-
ShoppingCartRemove01Icon,
|
|
7
|
-
} from "@hugeicons/core-free-icons";
|
|
8
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
id: string | number;
|
|
12
|
-
isCart: boolean;
|
|
13
|
-
isLoading?: boolean;
|
|
14
|
-
onCartClick?: (id: string | number) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
let { id, isCart, isLoading = false, onCartClick }: Props = $props();
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
{#if isLoading}
|
|
21
|
-
<Skeleton class="w-8 h-8 rounded-full" />
|
|
22
|
-
{:else if isCart}
|
|
23
|
-
<Button
|
|
24
|
-
class="w-8 h-8 rounded-full bg-[#1d63be]"
|
|
25
|
-
onclick={() => onCartClick!(id)}
|
|
26
|
-
>
|
|
27
|
-
<HugeiconsIcon icon={ShoppingCartRemove01Icon} />
|
|
28
|
-
</Button>
|
|
29
|
-
{:else}
|
|
30
|
-
<Button
|
|
31
|
-
class="w-8 h-8 rounded-full bg-[#808080]"
|
|
32
|
-
onclick={() => onCartClick!(id)}
|
|
33
|
-
>
|
|
34
|
-
<HugeiconsIcon icon={ShoppingCartAdd01Icon} />
|
|
35
|
-
</Button>
|
|
36
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from "../../../ui/button/index.js";
|
|
3
|
+
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
+
import {
|
|
5
|
+
ShoppingCartAdd01Icon,
|
|
6
|
+
ShoppingCartRemove01Icon,
|
|
7
|
+
} from "@hugeicons/core-free-icons";
|
|
8
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
id: string | number;
|
|
12
|
+
isCart: boolean;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
onCartClick?: (id: string | number) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let { id, isCart, isLoading = false, onCartClick }: Props = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#if isLoading}
|
|
21
|
+
<Skeleton class="w-8 h-8 rounded-full" />
|
|
22
|
+
{:else if isCart}
|
|
23
|
+
<Button
|
|
24
|
+
class="w-8 h-8 rounded-full bg-[#1d63be]"
|
|
25
|
+
onclick={() => onCartClick!(id)}
|
|
26
|
+
>
|
|
27
|
+
<HugeiconsIcon icon={ShoppingCartRemove01Icon} />
|
|
28
|
+
</Button>
|
|
29
|
+
{:else}
|
|
30
|
+
<Button
|
|
31
|
+
class="w-8 h-8 rounded-full bg-[#808080]"
|
|
32
|
+
onclick={() => onCartClick!(id)}
|
|
33
|
+
>
|
|
34
|
+
<HugeiconsIcon icon={ShoppingCartAdd01Icon} />
|
|
35
|
+
</Button>
|
|
36
|
+
{/if}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Message01Icon } from "@hugeicons/core-free-icons";
|
|
3
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
-
import TruncatableText from "./TruncatableText.svelte";
|
|
5
|
-
import { t } from "../../../../i18n";
|
|
6
|
-
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
7
|
-
|
|
8
|
-
type CardDescriptionProps = {
|
|
9
|
-
lines?: number;
|
|
10
|
-
content?: string;
|
|
11
|
-
isLoading?: boolean;
|
|
12
|
-
isDescriptionIcon?: boolean;
|
|
13
|
-
isDescriptionLabel?: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
let {
|
|
17
|
-
lines = 2,
|
|
18
|
-
content,
|
|
19
|
-
isLoading = false,
|
|
20
|
-
isDescriptionIcon = false,
|
|
21
|
-
isDescriptionLabel = true,
|
|
22
|
-
}: CardDescriptionProps = $props();
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
{#if isLoading}
|
|
26
|
-
<Skeleton class="w-full h-full bg-gray-500/89" />
|
|
27
|
-
{:else if content}
|
|
28
|
-
{#if isDescriptionLabel}
|
|
29
|
-
<div class="mb-1 text-[14px] md:text-[15px] flex items-center gap-1">
|
|
30
|
-
{#if isDescriptionIcon}
|
|
31
|
-
<HugeiconsIcon icon={Message01Icon} class="h-4 w-4" />
|
|
32
|
-
{/if}
|
|
33
|
-
<div>{$t("label.description")}</div>
|
|
34
|
-
</div>
|
|
35
|
-
{/if}
|
|
36
|
-
<TruncatableText
|
|
37
|
-
text={content}
|
|
38
|
-
{lines}
|
|
39
|
-
class="text-justify text-[13px] md:text-[14px] text-gray-800 dark:text-gray-50 mt-3 my-2 h-[65px] mb-1"
|
|
40
|
-
/>
|
|
41
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Message01Icon } from "@hugeicons/core-free-icons";
|
|
3
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
+
import TruncatableText from "./TruncatableText.svelte";
|
|
5
|
+
import { t } from "../../../../i18n";
|
|
6
|
+
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
7
|
+
|
|
8
|
+
type CardDescriptionProps = {
|
|
9
|
+
lines?: number;
|
|
10
|
+
content?: string;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
isDescriptionIcon?: boolean;
|
|
13
|
+
isDescriptionLabel?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
lines = 2,
|
|
18
|
+
content,
|
|
19
|
+
isLoading = false,
|
|
20
|
+
isDescriptionIcon = false,
|
|
21
|
+
isDescriptionLabel = true,
|
|
22
|
+
}: CardDescriptionProps = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if isLoading}
|
|
26
|
+
<Skeleton class="w-full h-full bg-gray-500/89" />
|
|
27
|
+
{:else if content}
|
|
28
|
+
{#if isDescriptionLabel}
|
|
29
|
+
<div class="mb-1 text-[14px] md:text-[15px] flex items-center gap-1">
|
|
30
|
+
{#if isDescriptionIcon}
|
|
31
|
+
<HugeiconsIcon icon={Message01Icon} class="h-4 w-4" />
|
|
32
|
+
{/if}
|
|
33
|
+
<div>{$t("label.description")}</div>
|
|
34
|
+
</div>
|
|
35
|
+
{/if}
|
|
36
|
+
<TruncatableText
|
|
37
|
+
text={content}
|
|
38
|
+
{lines}
|
|
39
|
+
class="text-justify text-[13px] md:text-[14px] text-gray-800 dark:text-gray-50 mt-3 my-2 h-[65px] mb-1"
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Button } from "../../../ui/button/index.js";
|
|
3
|
-
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
-
import { HeartAddIcon, HeartRemoveIcon } from "@hugeicons/core-free-icons";
|
|
5
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
id: string | number;
|
|
9
|
-
isFavorite: boolean;
|
|
10
|
-
isLoading?: boolean;
|
|
11
|
-
onFavoriteClick?: (id: string | number) => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
let { id, isFavorite, isLoading = false, onFavoriteClick }: Props = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
{#if isLoading}
|
|
18
|
-
<Skeleton class="w-8 h-8 rounded-full" />
|
|
19
|
-
{:else if isFavorite}
|
|
20
|
-
<Button
|
|
21
|
-
class="w-8 h-8 rounded-full bg-[#ce2356]"
|
|
22
|
-
onclick={() => onFavoriteClick!(id)}
|
|
23
|
-
>
|
|
24
|
-
<HugeiconsIcon icon={HeartRemoveIcon} />
|
|
25
|
-
</Button>
|
|
26
|
-
{:else}
|
|
27
|
-
<Button
|
|
28
|
-
class="w-8 h-8 rounded-full bg-[#808080]"
|
|
29
|
-
onclick={() => onFavoriteClick!(id)}
|
|
30
|
-
>
|
|
31
|
-
<HugeiconsIcon icon={HeartAddIcon} />
|
|
32
|
-
</Button>
|
|
33
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from "../../../ui/button/index.js";
|
|
3
|
+
import Skeleton from "../../../ui/skeleton/skeleton.svelte";
|
|
4
|
+
import { HeartAddIcon, HeartRemoveIcon } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
id: string | number;
|
|
9
|
+
isFavorite: boolean;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
onFavoriteClick?: (id: string | number) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let { id, isFavorite, isLoading = false, onFavoriteClick }: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#if isLoading}
|
|
18
|
+
<Skeleton class="w-8 h-8 rounded-full" />
|
|
19
|
+
{:else if isFavorite}
|
|
20
|
+
<Button
|
|
21
|
+
class="w-8 h-8 rounded-full bg-[#ce2356]"
|
|
22
|
+
onclick={() => onFavoriteClick!(id)}
|
|
23
|
+
>
|
|
24
|
+
<HugeiconsIcon icon={HeartRemoveIcon} />
|
|
25
|
+
</Button>
|
|
26
|
+
{:else}
|
|
27
|
+
<Button
|
|
28
|
+
class="w-8 h-8 rounded-full bg-[#808080]"
|
|
29
|
+
onclick={() => onFavoriteClick!(id)}
|
|
30
|
+
>
|
|
31
|
+
<HugeiconsIcon icon={HeartAddIcon} />
|
|
32
|
+
</Button>
|
|
33
|
+
{/if}
|