@rimelight/ui 0.0.5 → 0.0.6
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/package.json +17 -8
- package/src/components/BlogPost.astro +181 -0
- package/src/components/DynamicShowcase.astro +681 -0
- package/src/components/ExtendedCarousel.astro +107 -0
- package/src/components/Head.astro +150 -0
- package/src/components/LanguageSwitcher.astro +128 -0
- package/src/components/ProjectPost.astro +183 -0
- package/src/components/RLHead.astro +3 -0
- package/src/components/ThemeToggle.astro +30 -42
- package/src/components/astro/RLAButton.astro +32 -42
- package/src/components/astro/RLAHeader.astro +75 -0
- package/src/components/vue/RLVButton.vue +50 -37
- package/src/components/vue/RLVHeader.vue +78 -0
- package/src/composables/index.ts +1 -1
- package/src/composables/{useComponentUI.ts → useUi.ts} +2 -2
- package/src/config/index.ts +0 -2
- package/src/config/site.config.ts +1 -1
- package/src/integrations/ui.ts +6 -0
- package/src/themes/button.theme.ts +350 -34
- package/src/themes/header.theme.ts +33 -0
- package/src/themes/index.ts +3 -1
- package/src/utils/index.ts +3 -2
- package/i18n-data.json +0 -186
- package/src/components/accordion/Accordion.astro +0 -257
- package/src/components/accordion/AccordionContent.astro +0 -34
- package/src/components/accordion/AccordionItem.astro +0 -29
- package/src/components/accordion/AccordionTrigger.astro +0 -33
- package/src/components/alert/Alert.astro +0 -34
- package/src/components/alert/AlertDescription.astro +0 -15
- package/src/components/alert/AlertTitle.astro +0 -17
- package/src/components/alert-dialog/AlertDialog.astro +0 -275
- package/src/components/alert-dialog/AlertDialogAction.astro +0 -46
- package/src/components/alert-dialog/AlertDialogCancel.astro +0 -46
- package/src/components/alert-dialog/AlertDialogContent.astro +0 -52
- package/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
- package/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
- package/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
- package/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
- package/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
- package/src/components/aspect-ratio/AspectRatio.astro +0 -32
- package/src/components/avatar/Avatar.astro +0 -29
- package/src/components/avatar/AvatarFallback.astro +0 -18
- package/src/components/avatar/AvatarImage.astro +0 -66
- package/src/components/badge/Badge.astro +0 -57
- package/src/components/breadcrumb/Breadcrumb.astro +0 -12
- package/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -29
- package/src/components/breadcrumb/BreadcrumbItem.astro +0 -15
- package/src/components/breadcrumb/BreadcrumbLink.astro +0 -24
- package/src/components/breadcrumb/BreadcrumbList.astro +0 -17
- package/src/components/breadcrumb/BreadcrumbPage.astro +0 -22
- package/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -24
- package/src/components/button/Button.astro +0 -58
- package/src/components/button-group/ButtonGroup.astro +0 -64
- package/src/components/button-group/ButtonGroupSeparator.astro +0 -20
- package/src/components/button-group/ButtonGroupText.astro +0 -19
- package/src/components/card/Card.astro +0 -36
- package/src/components/card/CardAction.astro +0 -16
- package/src/components/card/CardContent.astro +0 -16
- package/src/components/card/CardDescription.astro +0 -16
- package/src/components/card/CardFooter.astro +0 -16
- package/src/components/card/CardHeader.astro +0 -19
- package/src/components/card/CardTitle.astro +0 -16
- package/src/components/carousel/Carousel.astro +0 -55
- package/src/components/carousel/CarouselContent.astro +0 -26
- package/src/components/carousel/CarouselItem.astro +0 -26
- package/src/components/carousel/CarouselNext.astro +0 -39
- package/src/components/carousel/CarouselPrevious.astro +0 -41
- package/src/components/carousel/carousel-script.ts +0 -188
- package/src/components/carousel/index.ts +0 -1
- package/src/components/checkbox/Checkbox.astro +0 -133
- package/src/components/collapsible/Collapsible.astro +0 -161
- package/src/components/collapsible/CollapsibleContent.astro +0 -22
- package/src/components/collapsible/CollapsibleTrigger.astro +0 -44
- package/src/components/dialog/Dialog.astro +0 -389
- package/src/components/dialog/DialogClose.astro +0 -35
- package/src/components/dialog/DialogContent.astro +0 -78
- package/src/components/dialog/DialogDescription.astro +0 -14
- package/src/components/dialog/DialogFooter.astro +0 -14
- package/src/components/dialog/DialogHeader.astro +0 -14
- package/src/components/dialog/DialogTitle.astro +0 -18
- package/src/components/dialog/DialogTrigger.astro +0 -47
- package/src/components/dropdown/Dropdown.astro +0 -604
- package/src/components/dropdown/DropdownContent.astro +0 -118
- package/src/components/dropdown/DropdownItem.astro +0 -48
- package/src/components/dropdown/DropdownLabel.astro +0 -29
- package/src/components/dropdown/DropdownSeparator.astro +0 -21
- package/src/components/dropdown/DropdownShortcut.astro +0 -17
- package/src/components/dropdown/DropdownSub.astro +0 -15
- package/src/components/dropdown/DropdownSubContent.astro +0 -39
- package/src/components/dropdown/DropdownSubTrigger.astro +0 -34
- package/src/components/dropdown/DropdownTrigger.astro +0 -52
- package/src/components/dropzone/Dropzone.astro +0 -236
- package/src/components/dropzone/DropzoneFilesList.astro +0 -26
- package/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
- package/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
- package/src/components/embeds/YoutubeEmbed.astro +0 -94
- package/src/components/hero/Hero.astro +0 -166
- package/src/components/icons/Flag.astro +0 -62
- package/src/components/image/ExtendedImage.astro +0 -46
- package/src/components/image/Image.astro +0 -25
- package/src/components/input/Input.astro +0 -27
- package/src/components/input-group/InputGroup.astro +0 -28
- package/src/components/input-group/InputGroupAddon.astro +0 -76
- package/src/components/input-group/InputGroupButton.astro +0 -36
- package/src/components/input-group/InputGroupInput.astro +0 -18
- package/src/components/input-group/InputGroupText.astro +0 -17
- package/src/components/input-group/InputGroupTextarea.astro +0 -22
- package/src/components/input-otp/InputOtp.astro +0 -352
- package/src/components/input-otp/InputOtpGroup.astro +0 -16
- package/src/components/input-otp/InputOtpSeparator.astro +0 -25
- package/src/components/input-otp/InputOtpSlot.astro +0 -50
- package/src/components/input-otp/InputOtpTypes.ts +0 -6
- package/src/components/item/Item.astro +0 -52
- package/src/components/item/ItemActions.astro +0 -16
- package/src/components/item/ItemContent.astro +0 -16
- package/src/components/item/ItemDescription.astro +0 -19
- package/src/components/item/ItemFooter.astro +0 -16
- package/src/components/item/ItemGroup.astro +0 -16
- package/src/components/item/ItemHeader.astro +0 -16
- package/src/components/item/ItemMedia.astro +0 -40
- package/src/components/item/ItemSeparator.astro +0 -23
- package/src/components/item/ItemTitle.astro +0 -16
- package/src/components/kbd/Kbd.astro +0 -21
- package/src/components/kbd/KbdGroup.astro +0 -16
- package/src/components/label/Label.astro +0 -24
- package/src/components/marquee/Marquee.astro +0 -73
- package/src/components/native-select/NativeSelect.astro +0 -68
- package/src/components/native-select/NativeSelectOptGroup.astro +0 -15
- package/src/components/native-select/NativeSelectOption.astro +0 -15
- package/src/components/pagination/Pagination.astro +0 -20
- package/src/components/pagination/PaginationContent.astro +0 -16
- package/src/components/pagination/PaginationEllipsis.astro +0 -37
- package/src/components/pagination/PaginationItem.astro +0 -16
- package/src/components/pagination/PaginationLink.astro +0 -27
- package/src/components/pagination/PaginationNext.astro +0 -33
- package/src/components/pagination/PaginationPrevious.astro +0 -33
- package/src/components/popover/Popover.astro +0 -717
- package/src/components/popover/PopoverContent.astro +0 -102
- package/src/components/popover/PopoverDescription.astro +0 -14
- package/src/components/popover/PopoverHeader.astro +0 -14
- package/src/components/popover/PopoverTitle.astro +0 -14
- package/src/components/popover/PopoverTrigger.astro +0 -51
- package/src/components/progress/Progress.astro +0 -154
- package/src/components/prose/Prose.astro +0 -619
- package/src/components/radio-group/RadioGroup.astro +0 -162
- package/src/components/radio-group/RadioGroupItem.astro +0 -133
- package/src/components/radio-group/RadioGroupTypes.ts +0 -6
- package/src/components/section/Section.astro +0 -167
- package/src/components/select/Select.astro +0 -752
- package/src/components/select/SelectContent.astro +0 -94
- package/src/components/select/SelectGroup.astro +0 -9
- package/src/components/select/SelectItem.astro +0 -51
- package/src/components/select/SelectLabel.astro +0 -14
- package/src/components/select/SelectSearch.astro +0 -49
- package/src/components/select/SelectSeparator.astro +0 -12
- package/src/components/select/SelectTrigger.astro +0 -56
- package/src/components/select/SelectTypes.ts +0 -13
- package/src/components/select/SelectValue.astro +0 -19
- package/src/components/separator/Separator.astro +0 -36
- package/src/components/sheet/Sheet.astro +0 -15
- package/src/components/sheet/SheetClose.astro +0 -15
- package/src/components/sheet/SheetContent.astro +0 -89
- package/src/components/sheet/SheetDescription.astro +0 -16
- package/src/components/sheet/SheetFooter.astro +0 -16
- package/src/components/sheet/SheetHeader.astro +0 -16
- package/src/components/sheet/SheetTitle.astro +0 -16
- package/src/components/sheet/SheetTrigger.astro +0 -15
- package/src/components/sidebar/Sidebar.astro +0 -231
- package/src/components/sidebar/SidebarContent.astro +0 -25
- package/src/components/sidebar/SidebarFooter.astro +0 -22
- package/src/components/sidebar/SidebarGroup.astro +0 -22
- package/src/components/sidebar/SidebarGroupContent.astro +0 -22
- package/src/components/sidebar/SidebarGroupLabel.astro +0 -53
- package/src/components/sidebar/SidebarHeader.astro +0 -22
- package/src/components/sidebar/SidebarInput.astro +0 -24
- package/src/components/sidebar/SidebarInset.astro +0 -22
- package/src/components/sidebar/SidebarMenu.astro +0 -22
- package/src/components/sidebar/SidebarMenuAction.astro +0 -63
- package/src/components/sidebar/SidebarMenuBadge.astro +0 -31
- package/src/components/sidebar/SidebarMenuButton.astro +0 -124
- package/src/components/sidebar/SidebarMenuItem.astro +0 -22
- package/src/components/sidebar/SidebarMenuSkeleton.astro +0 -43
- package/src/components/sidebar/SidebarMenuSub.astro +0 -25
- package/src/components/sidebar/SidebarMenuSubButton.astro +0 -52
- package/src/components/sidebar/SidebarMenuSubItem.astro +0 -17
- package/src/components/sidebar/SidebarProvider.astro +0 -215
- package/src/components/sidebar/SidebarRail.astro +0 -72
- package/src/components/sidebar/SidebarSeparator.astro +0 -25
- package/src/components/sidebar/SidebarTrigger.astro +0 -69
- package/src/components/skeleton/Skeleton.astro +0 -14
- package/src/components/slider/Slider.astro +0 -425
- package/src/components/spinner/Spinner.astro +0 -23
- package/src/components/switch/Switch.astro +0 -192
- package/src/components/switch/SwitchTypes.ts +0 -6
- package/src/components/table/Table.astro +0 -20
- package/src/components/table/TableBody.astro +0 -18
- package/src/components/table/TableCaption.astro +0 -18
- package/src/components/table/TableCell.astro +0 -18
- package/src/components/table/TableFoot.astro +0 -18
- package/src/components/table/TableHead.astro +0 -18
- package/src/components/table/TableHeader.astro +0 -18
- package/src/components/table/TableRow.astro +0 -17
- package/src/components/tabs/Tabs.astro +0 -270
- package/src/components/tabs/TabsContent.astro +0 -28
- package/src/components/tabs/TabsList.astro +0 -23
- package/src/components/tabs/TabsTrigger.astro +0 -34
- package/src/components/textarea/Textarea.astro +0 -31
- package/src/components/toast/ToastDescription.astro +0 -22
- package/src/components/toast/ToastItem.astro +0 -56
- package/src/components/toast/ToastTemplate.astro +0 -27
- package/src/components/toast/ToastTitle.astro +0 -59
- package/src/components/toast/Toaster.astro +0 -981
- package/src/components/toast/index.ts +0 -1
- package/src/components/toast/toast-manager.ts +0 -234
- package/src/components/toggle/Toggle.astro +0 -174
- package/src/components/toggle/ToggleTypes.ts +0 -14
- package/src/components/tooltip/Tooltip.astro +0 -422
- package/src/components/tooltip/TooltipContent.astro +0 -83
- package/src/components/tooltip/TooltipTrigger.astro +0 -13
- package/src/components/video/Video.astro +0 -121
- package/src/config/cookies.ts +0 -5
- package/src/config/links.ts +0 -4
- package/src/domain/cms/index.ts +0 -1
- package/src/domain/cms/types.ts +0 -20
- package/src/domain/i18n/constants.ts +0 -21
- package/src/domain/i18n/cookie-storage.ts +0 -13
- package/src/domain/i18n/country-to-locale-map.ts +0 -67
- package/src/domain/i18n/fallbacks.generated.ts +0 -230
- package/src/domain/i18n/fetcher.ts +0 -278
- package/src/domain/i18n/flags.ts +0 -16
- package/src/domain/i18n/format.ts +0 -90
- package/src/domain/i18n/index.ts +0 -10
- package/src/domain/i18n/middleware/i18n.ts +0 -161
- package/src/domain/i18n/resolve-locale.ts +0 -55
- package/src/domain/i18n/runtime-constants.ts +0 -14
- package/src/domain/i18n/schema.ts +0 -29
- package/src/domain/index.ts +0 -4
- package/src/domain/seo/constants.ts +0 -6
- package/src/domain/seo/index.ts +0 -3
- package/src/domain/seo/services/index.ts +0 -3
- package/src/domain/seo/services/llms.ts +0 -56
- package/src/domain/seo/services/robots.ts +0 -12
- package/src/domain/seo/services/sitemap.ts +0 -56
- package/src/domain/seo/utils.ts +0 -36
- package/src/domain/theme/constants.ts +0 -6
- package/src/domain/theme/index.ts +0 -2
- package/src/domain/theme/schema.ts +0 -10
- package/src/i18n.generated.d.ts +0 -202
- package/src/lib/component-preview.ts +0 -73
- package/src/lib/index.ts +0 -6
- package/src/lib/remark/remark-modified-time.ts +0 -13
- package/src/lib/showcase-preview-elements.ts +0 -408
- package/src/lib/showcase-renderer.ts +0 -218
- package/src/lib/showcase-utils.ts +0 -189
- package/src/lib/turnstile.ts +0 -35
- package/src/lib/utils/starwind/positioning.ts +0 -318
- package/src/locales/de/blog.json +0 -9
- package/src/locales/de/common.json +0 -19
- package/src/locales/de/errors.json +0 -6
- package/src/locales/de/home.json +0 -20
- package/src/locales/de/messages.json +0 -8
- package/src/locales/de/nav.json +0 -13
- package/src/locales/de/projects.json +0 -9
- package/src/locales/de/services.json +0 -43
- package/src/locales/en/blog.json +0 -9
- package/src/locales/en/chat.json +0 -29
- package/src/locales/en/common.json +0 -19
- package/src/locales/en/cookie_notice.json +0 -11
- package/src/locales/en/editor.json +0 -24
- package/src/locales/en/errors.json +0 -6
- package/src/locales/en/home.json +0 -20
- package/src/locales/en/messages.json +0 -8
- package/src/locales/en/nav.json +0 -13
- package/src/locales/en/projects.json +0 -9
- package/src/locales/en/services.json +0 -43
- package/src/locales/es/blog.json +0 -9
- package/src/locales/es/common.json +0 -19
- package/src/locales/es/errors.json +0 -6
- package/src/locales/es/home.json +0 -20
- package/src/locales/es/messages.json +0 -8
- package/src/locales/es/nav.json +0 -13
- package/src/locales/es/projects.json +0 -9
- package/src/locales/es/services.json +0 -43
- package/src/locales/ja/blog.json +0 -9
- package/src/locales/ja/common.json +0 -19
- package/src/locales/ja/errors.json +0 -6
- package/src/locales/ja/home.json +0 -20
- package/src/locales/ja/messages.json +0 -8
- package/src/locales/ja/nav.json +0 -13
- package/src/locales/ja/projects.json +0 -9
- package/src/locales/ja/services.json +0 -43
- package/src/locales/pt/blog.json +0 -9
- package/src/locales/pt/chat.json +0 -29
- package/src/locales/pt/common.json +0 -19
- package/src/locales/pt/cookie_notice.json +0 -11
- package/src/locales/pt/editor.json +0 -24
- package/src/locales/pt/errors.json +0 -6
- package/src/locales/pt/home.json +0 -20
- package/src/locales/pt/messages.json +0 -8
- package/src/locales/pt/nav.json +0 -13
- package/src/locales/pt/projects.json +0 -9
- package/src/locales/pt/services.json +0 -43
- package/src/utils/server/cookies.ts +0 -98
- package/src/utils/server/index.ts +0 -1
- package/src/utils/shared/index.ts +0 -3
- /package/src/utils/{shared/deep-merge.ts → deep-merge.ts} +0 -0
- /package/src/utils/{shared/embed.ts → embed.ts} +0 -0
- /package/src/utils/{shared/parse-boolean.ts → parse-boolean.ts} +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Carousel from "@rimelight/ui/components/carousel/Carousel.astro";
|
|
3
|
+
import CarouselPrevious from "@rimelight/ui/components/carousel/CarouselPrevious.astro";
|
|
4
|
+
import CarouselNext from "@rimelight/ui/components/carousel/CarouselNext.astro";
|
|
5
|
+
import type { HTMLAttributes } from "astro/types";
|
|
6
|
+
import type { EmblaOptionsType } from "embla-carousel";
|
|
7
|
+
|
|
8
|
+
export interface ExtendedCarouselProps extends HTMLAttributes<"div"> {
|
|
9
|
+
opts?: EmblaOptionsType;
|
|
10
|
+
orientation?: "horizontal" | "vertical";
|
|
11
|
+
showDots?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type Props = ExtendedCarouselProps;
|
|
14
|
+
|
|
15
|
+
const { opts = {}, orientation = "horizontal", showDots = true, class: className, ...rest } = Astro.props;
|
|
16
|
+
|
|
17
|
+
// Default loop to true for ExtendedCarousel
|
|
18
|
+
const carouselOpts: EmblaOptionsType = {
|
|
19
|
+
loop: true,
|
|
20
|
+
...opts
|
|
21
|
+
};
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<Carousel
|
|
25
|
+
opts={carouselOpts}
|
|
26
|
+
orientation={orientation}
|
|
27
|
+
class:list={["extended-carousel group/extended-carousel", className]}
|
|
28
|
+
{...rest}
|
|
29
|
+
data-extended-carousel
|
|
30
|
+
autoInit={false}
|
|
31
|
+
>
|
|
32
|
+
<slot />
|
|
33
|
+
|
|
34
|
+
<div class="hidden md:block">
|
|
35
|
+
<CarouselPrevious class="-left-12 opacity-50 hover:opacity-100 transition-opacity" />
|
|
36
|
+
<CarouselNext class="-right-12 opacity-50 hover:opacity-100 transition-opacity" />
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{showDots && (
|
|
40
|
+
<div class="carousel-pagination absolute bottom-8 left-1/2 -translate-x-1/2 z-10 flex justify-center items-center gap-1.5" data-slot="pagination">
|
|
41
|
+
{/* Dots injected by script */}
|
|
42
|
+
</div>
|
|
43
|
+
)}
|
|
44
|
+
</Carousel>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import { initCarousel } from "@rimelight/ui/components/carousel/carousel-script.ts";
|
|
48
|
+
|
|
49
|
+
const setupExtendedCarousels = () => {
|
|
50
|
+
const extendedCarousels = document.querySelectorAll('[data-extended-carousel]') as NodeListOf<HTMLElement>;
|
|
51
|
+
|
|
52
|
+
extendedCarousels.forEach((carousel) => {
|
|
53
|
+
// Avoid double-initialization
|
|
54
|
+
if (carousel.dataset.extendedInitialized === "true") return;
|
|
55
|
+
carousel.dataset.extendedInitialized = "true";
|
|
56
|
+
|
|
57
|
+
// Initialize the underlying Starwind carousel
|
|
58
|
+
// Passing autoInit={false} to the component means we handle init here
|
|
59
|
+
const manager = initCarousel(carousel);
|
|
60
|
+
if (!manager) return;
|
|
61
|
+
|
|
62
|
+
const api = manager.api;
|
|
63
|
+
const pagination = carousel.querySelector('[data-slot="pagination"]');
|
|
64
|
+
|
|
65
|
+
if (pagination) {
|
|
66
|
+
const scrollSnaps = api.scrollSnapList();
|
|
67
|
+
const dots: HTMLButtonElement[] = [];
|
|
68
|
+
|
|
69
|
+
// Clear existing (useful for handle re-init cases)
|
|
70
|
+
pagination.innerHTML = '';
|
|
71
|
+
|
|
72
|
+
scrollSnaps.forEach((_: number, index: number) => {
|
|
73
|
+
const dot = document.createElement('button');
|
|
74
|
+
dot.className = 'size-4 rounded-full bg-border transition-all hover:bg-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary h-4 cursor-pointer';
|
|
75
|
+
dot.setAttribute('aria-label', `Go to slide ${index + 1}`);
|
|
76
|
+
dot.addEventListener('click', () => api.scrollTo(index));
|
|
77
|
+
pagination.appendChild(dot);
|
|
78
|
+
dots.push(dot);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const updateDots = () => {
|
|
82
|
+
const selectedIndex = api.selectedScrollSnap();
|
|
83
|
+
dots.forEach((dot, index) => {
|
|
84
|
+
if (index === selectedIndex) {
|
|
85
|
+
dot.classList.add('bg-primary');
|
|
86
|
+
dot.classList.remove('bg-border');
|
|
87
|
+
} else {
|
|
88
|
+
dot.classList.remove('bg-primary');
|
|
89
|
+
dot.classList.add('bg-border');
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
api.on('select', updateDots);
|
|
95
|
+
api.on('init', updateDots);
|
|
96
|
+
api.on('reInit', updateDots);
|
|
97
|
+
|
|
98
|
+
updateDots();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Run on load and after Astro page swaps
|
|
104
|
+
document.addEventListener("DOMContentLoaded", setupExtendedCarousels);
|
|
105
|
+
document.addEventListener("astro:after-swap", setupExtendedCarousels);
|
|
106
|
+
</script>
|
|
107
|
+
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { ClientRouter } from 'astro:transitions';
|
|
3
|
+
import type { SiteConfig } from '@/config';
|
|
4
|
+
|
|
5
|
+
export interface HeadProps {
|
|
6
|
+
/** Page title */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Page description */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Open Graph image URL */
|
|
11
|
+
ogImage?: string;
|
|
12
|
+
/** Whether to prevent indexing */
|
|
13
|
+
noindex?: boolean;
|
|
14
|
+
/** Whether this is a 404 page */
|
|
15
|
+
is404?: boolean;
|
|
16
|
+
/** Robots metadata (overrides noindex/is404 logic if provided) */
|
|
17
|
+
robots?: string;
|
|
18
|
+
/** Canonical URL */
|
|
19
|
+
canonical?: string;
|
|
20
|
+
/** Language alternates for i18n */
|
|
21
|
+
languageAlternates?: Array<{ hreflang: string; href: string }>;
|
|
22
|
+
/** Site configuration for defaults */
|
|
23
|
+
config?: SiteConfig;
|
|
24
|
+
/** Whether to enable View Transitions (ClientRouter) */
|
|
25
|
+
transitions?: boolean;
|
|
26
|
+
/** Meta charset */
|
|
27
|
+
charset?: string;
|
|
28
|
+
/** Meta viewport */
|
|
29
|
+
viewport?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
title,
|
|
34
|
+
description,
|
|
35
|
+
ogImage,
|
|
36
|
+
noindex = false,
|
|
37
|
+
is404 = false,
|
|
38
|
+
robots,
|
|
39
|
+
canonical,
|
|
40
|
+
languageAlternates = [],
|
|
41
|
+
config,
|
|
42
|
+
transitions = true,
|
|
43
|
+
charset = "utf-8",
|
|
44
|
+
viewport = "width=device-width,initial-scale=1",
|
|
45
|
+
} = Astro.props as HeadProps
|
|
46
|
+
|
|
47
|
+
// Resolve defaults from config if available
|
|
48
|
+
const siteName = config?.name || "Rimelight";
|
|
49
|
+
const siteUrl = config?.url || "";
|
|
50
|
+
const siteDescription = config?.description || "";
|
|
51
|
+
const ogImageFallback = config?.seo?.ogImageFallback || config?.ogImage || "";
|
|
52
|
+
const themeColor = config?.branding?.colors?.themeColor;
|
|
53
|
+
const favicon = config?.branding?.favicon?.svg || "/favicon.svg";
|
|
54
|
+
const twitterHandle = config?.seo?.authorHandle;
|
|
55
|
+
const titleTemplate = config?.seo?.titleTemplate || `%s | ${siteName}`;
|
|
56
|
+
|
|
57
|
+
// Calculated Values
|
|
58
|
+
const displayTitle = is404
|
|
59
|
+
? `404 - Not Found | ${siteName}`
|
|
60
|
+
: title
|
|
61
|
+
? titleTemplate.replace('%s', title)
|
|
62
|
+
: siteName;
|
|
63
|
+
|
|
64
|
+
const finalDescription = description || siteDescription;
|
|
65
|
+
const safeDescription = finalDescription && config?.seo?.maxDescriptionLength
|
|
66
|
+
? (finalDescription.length > config.seo.maxDescriptionLength
|
|
67
|
+
? finalDescription.slice(0, config.seo.maxDescriptionLength - 3) + "..."
|
|
68
|
+
: finalDescription)
|
|
69
|
+
: finalDescription;
|
|
70
|
+
|
|
71
|
+
const finalOgImage = ogImage || ogImageFallback;
|
|
72
|
+
const absoluteOgImage = finalOgImage
|
|
73
|
+
? (finalOgImage.startsWith('http') ? finalOgImage : `${siteUrl}${finalOgImage}`)
|
|
74
|
+
: undefined;
|
|
75
|
+
|
|
76
|
+
const finalCanonical = canonical || (!is404 ? Astro.url.href : undefined);
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
<!-- Basic Metadata -->
|
|
80
|
+
<meta charset={charset} />
|
|
81
|
+
<meta name="viewport" content={viewport} />
|
|
82
|
+
<meta name="generator" content={Astro.generator} />
|
|
83
|
+
|
|
84
|
+
<!-- SEO -->
|
|
85
|
+
<title>{displayTitle}</title>
|
|
86
|
+
{safeDescription && <meta name="description" content={safeDescription} />}
|
|
87
|
+
{robots ? <meta name="robots" content={robots} /> : (noindex || is404) && <meta name="robots" content="noindex, nofollow" />}
|
|
88
|
+
{finalCanonical && <link rel="canonical" href={finalCanonical} />}
|
|
89
|
+
|
|
90
|
+
<!-- i18n Alternates -->
|
|
91
|
+
{languageAlternates.map((alt) => (
|
|
92
|
+
<link rel="alternate" hreflang={alt.hreflang} href={alt.href} />
|
|
93
|
+
))}
|
|
94
|
+
|
|
95
|
+
<!-- Open Graph / Facebook -->
|
|
96
|
+
<meta property="og:type" content="website" />
|
|
97
|
+
<meta property="og:url" content={Astro.url.href} />
|
|
98
|
+
<meta property="og:title" content={title || siteName} />
|
|
99
|
+
{safeDescription && <meta property="og:description" content={safeDescription} />}
|
|
100
|
+
{absoluteOgImage && <meta property="og:image" content={absoluteOgImage} />}
|
|
101
|
+
<meta property="og:site_name" content={siteName} />
|
|
102
|
+
|
|
103
|
+
<!-- Twitter -->
|
|
104
|
+
<meta property="twitter:card" content="summary_large_image" />
|
|
105
|
+
<meta property="twitter:url" content={Astro.url.href} />
|
|
106
|
+
<meta property="twitter:title" content={title || siteName} />
|
|
107
|
+
{safeDescription && <meta property="twitter:description" content={safeDescription} />}
|
|
108
|
+
{absoluteOgImage && <meta property="twitter:image" content={absoluteOgImage} />}
|
|
109
|
+
{twitterHandle && <meta property="twitter:site" content={twitterHandle} />}
|
|
110
|
+
{twitterHandle && <meta property="twitter:creator" content={twitterHandle} />}
|
|
111
|
+
|
|
112
|
+
<!-- Icons -->
|
|
113
|
+
<link rel="icon" type="image/svg+xml" href={favicon} />
|
|
114
|
+
|
|
115
|
+
<!-- Theme -->
|
|
116
|
+
{themeColor && <meta name="theme-color" content={themeColor} />}
|
|
117
|
+
|
|
118
|
+
<script is:inline>
|
|
119
|
+
const theme = (() => {
|
|
120
|
+
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
|
121
|
+
return localStorage.getItem('theme');
|
|
122
|
+
}
|
|
123
|
+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
124
|
+
return 'dark';
|
|
125
|
+
}
|
|
126
|
+
return 'light';
|
|
127
|
+
})();
|
|
128
|
+
|
|
129
|
+
if (theme === 'dark') {
|
|
130
|
+
document.documentElement.classList.add('dark');
|
|
131
|
+
} else {
|
|
132
|
+
document.documentElement.classList.remove('dark');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
window.localStorage.setItem('theme', theme);
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<script>
|
|
139
|
+
document.addEventListener('astro:after-swap', () => {
|
|
140
|
+
if (localStorage.getItem('theme') === 'dark') {
|
|
141
|
+
document.documentElement.classList.add('dark');
|
|
142
|
+
} else {
|
|
143
|
+
document.documentElement.classList.remove('dark');
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
{transitions && <ClientRouter />}
|
|
149
|
+
|
|
150
|
+
<slot />
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Language Switcher Component (Extension)
|
|
4
|
+
*
|
|
5
|
+
* Variants:
|
|
6
|
+
* - 'full': Shows language icon, current flag, name, and chevron
|
|
7
|
+
* - 'label' (default): Shows language icon and current flag only
|
|
8
|
+
*
|
|
9
|
+
* Uses Starwind components for consistency.
|
|
10
|
+
* Built using native Astro i18n features.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import Dropdown from "@rimelight/ui/components/dropdown/Dropdown.astro";
|
|
14
|
+
import DropdownTrigger from "@rimelight/ui/components/dropdown/DropdownTrigger.astro";
|
|
15
|
+
import DropdownContent from "@rimelight/ui/components/dropdown/DropdownContent.astro";
|
|
16
|
+
import DropdownItem from "@rimelight/ui/components/dropdown/DropdownItem.astro";
|
|
17
|
+
import Button from "@rimelight/ui/components/button/Button.astro";
|
|
18
|
+
import Flag from "@rimelight/ui/components/icons/Flag.astro";
|
|
19
|
+
|
|
20
|
+
import { SUPPORTED_LOCALES, LANGUAGES } from "@rimelight/ui/domain";
|
|
21
|
+
import { localeToFlagCode } from "@rimelight/ui/domain";
|
|
22
|
+
import { replaceLocaleInPath } from "@rimelight/ui/domain";
|
|
23
|
+
import type { Locale } from "@rimelight/ui/domain";
|
|
24
|
+
|
|
25
|
+
export interface LanguageSwitcherProps {
|
|
26
|
+
variant?: 'full' | 'label';
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
type Props = LanguageSwitcherProps;
|
|
30
|
+
|
|
31
|
+
const { variant = 'label', class: className } = Astro.props;
|
|
32
|
+
const { uiLocale: currentLocale } = Astro.locals;
|
|
33
|
+
const currentPath = Astro.url.pathname;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Utility to compute the target URL for a locale switch
|
|
37
|
+
* Handles standard Astro routing by replacing the locale prefix in the URL.
|
|
38
|
+
*/
|
|
39
|
+
function getSwitchUrl(targetLocale: string) {
|
|
40
|
+
return replaceLocaleInPath(currentPath, currentLocale as string, targetLocale);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const currentFlagCode = localeToFlagCode(currentLocale as Locale);
|
|
44
|
+
const currentLabel = LANGUAGES[(currentLocale as Locale) as keyof typeof LANGUAGES] || currentLocale;
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
<Dropdown class={className}>
|
|
48
|
+
<DropdownTrigger asChild>
|
|
49
|
+
<Button
|
|
50
|
+
variant="outline"
|
|
51
|
+
size="sm"
|
|
52
|
+
class:list={[
|
|
53
|
+
"rounded-full border-border/50 bg-background/50 hover:bg-background transition-all h-9 shadow-none",
|
|
54
|
+
variant === 'full' ? "px-3xs" : "px-5xs",
|
|
55
|
+
]}
|
|
56
|
+
aria-label="Select Language"
|
|
57
|
+
>
|
|
58
|
+
<div class="flex items-center gap-5xs">
|
|
59
|
+
<div class="flex items-center justify-center shrink-0 opacity-70 size-4.5">
|
|
60
|
+
<svg
|
|
61
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
+
class="text-current size-4.5"
|
|
63
|
+
viewBox="0 0 24 24"
|
|
64
|
+
fill="none"
|
|
65
|
+
stroke="currentColor"
|
|
66
|
+
stroke-width="2"
|
|
67
|
+
stroke-linecap="round"
|
|
68
|
+
stroke-linejoin="round"
|
|
69
|
+
>
|
|
70
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 5h7" /><path d="M9 3v2c0 4.418 -2.239 8 -5 8" /><path d="M5 9c0 2.144 2.952 3.908 6.7 4" /><path d="M12 20l4 -9l4 9" /><path d="M19.1 18h-6.2" />
|
|
71
|
+
</svg>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="flex items-center -translate-y-[0.5px]">
|
|
75
|
+
<Flag code={currentFlagCode} size={18} class="rounded-sm shadow-sm border border-border/20" />
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
{variant === 'full' && (
|
|
79
|
+
<div class="flex items-center gap-5xs border-l border-border/30 pl-5xs ml-3xs">
|
|
80
|
+
<span class="text-xs font-medium text-muted-foreground whitespace-nowrap leading-none flex items-center translate-y-[0.5px]">
|
|
81
|
+
{currentLabel}
|
|
82
|
+
</span>
|
|
83
|
+
<div class="flex items-center justify-center opacity-50 -translate-y-[0.5px]">
|
|
84
|
+
<svg class="size-3.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
|
85
|
+
<path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd" />
|
|
86
|
+
</svg>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
</Button>
|
|
92
|
+
</DropdownTrigger>
|
|
93
|
+
|
|
94
|
+
<DropdownContent align="end" class="w-6xl border-border/50 bg-background/95 backdrop-blur-md p-5xs">
|
|
95
|
+
{SUPPORTED_LOCALES.map((locale) => {
|
|
96
|
+
const isActive = locale === currentLocale;
|
|
97
|
+
const href = getSwitchUrl(locale);
|
|
98
|
+
const flagCode = localeToFlagCode(locale as Locale);
|
|
99
|
+
const label = LANGUAGES[(locale as Locale) as keyof typeof LANGUAGES] || locale;
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<DropdownItem
|
|
103
|
+
as="a"
|
|
104
|
+
href={href}
|
|
105
|
+
class:list={[
|
|
106
|
+
"flex items-center h-10 px-3xs gap-3xs transition-colors rounded-lg",
|
|
107
|
+
isActive ? "bg-accent/70 text-foreground font-semibold" : "text-muted-foreground hover:text-foreground"
|
|
108
|
+
]}
|
|
109
|
+
>
|
|
110
|
+
<div class="flex items-center shrink-0 -translate-y-[0.5px]">
|
|
111
|
+
<Flag code={flagCode} size={18} class="rounded-sm shadow-sm border border-border/20" />
|
|
112
|
+
</div>
|
|
113
|
+
<span class="text-sm leading-none flex items-center translate-y-[0.5px]">{label}</span>
|
|
114
|
+
{isActive && (
|
|
115
|
+
<div class="ml-auto flex items-center justify-center h-full text-primary">
|
|
116
|
+
<svg class="size-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
|
117
|
+
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
|
|
118
|
+
</svg>
|
|
119
|
+
</div>
|
|
120
|
+
)}
|
|
121
|
+
</DropdownItem>
|
|
122
|
+
);
|
|
123
|
+
})}
|
|
124
|
+
|
|
125
|
+
</DropdownContent>
|
|
126
|
+
</Dropdown>
|
|
127
|
+
|
|
128
|
+
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Image } from "astro:assets";
|
|
3
|
+
import { scv } from "css-variants";
|
|
4
|
+
import type { CollectionEntry } from "astro:content";
|
|
5
|
+
import Separator from "@rimelight/ui/components/separator/Separator.astro";
|
|
6
|
+
import Avatar from "@rimelight/ui/components/avatar/Avatar.astro";
|
|
7
|
+
import AvatarImage from "@rimelight/ui/components/avatar/AvatarImage.astro";
|
|
8
|
+
import avatarAsset from "../assets/team/Daniel-Marchi_0000_00.webp";
|
|
9
|
+
import { fetchTranslations } from "@rimelight/ui/domain";
|
|
10
|
+
|
|
11
|
+
const { translationLocale, cfContext } = Astro.locals;
|
|
12
|
+
const runtime = { cf: Astro.request.cf, cfContext };
|
|
13
|
+
const { projects: t } = await fetchTranslations(runtime, translationLocale, ["projects"]);
|
|
14
|
+
|
|
15
|
+
// Support both Astro content collections and CMS documents
|
|
16
|
+
export type CMSProjectDocument = {
|
|
17
|
+
_id: string;
|
|
18
|
+
slug?: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
heroImage?: string;
|
|
22
|
+
publishedDate?: string | Date | null;
|
|
23
|
+
featured?: boolean;
|
|
24
|
+
tags?: string[] | Record<string, unknown> | null;
|
|
25
|
+
_updatedAt?: string;
|
|
26
|
+
_createdAt?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface ProjectPostProps extends NonNullable<Parameters<typeof projectPostVariants>[0]> {
|
|
30
|
+
project: CollectionEntry<"projects"> | CMSProjectDocument;
|
|
31
|
+
class?: string;
|
|
32
|
+
showImage?: boolean;
|
|
33
|
+
separator?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type Props = ProjectPostProps;
|
|
37
|
+
|
|
38
|
+
const projectPostVariants = scv({
|
|
39
|
+
slots: [
|
|
40
|
+
"root",
|
|
41
|
+
"imageWrapper",
|
|
42
|
+
"image",
|
|
43
|
+
"content",
|
|
44
|
+
"title",
|
|
45
|
+
"description",
|
|
46
|
+
"footer",
|
|
47
|
+
"authorGroup",
|
|
48
|
+
"author",
|
|
49
|
+
"link",
|
|
50
|
+
"badge",
|
|
51
|
+
"featuredBadge"
|
|
52
|
+
],
|
|
53
|
+
base: {
|
|
54
|
+
root: "group flex transition-all duration-300 w-full",
|
|
55
|
+
imageWrapper: "relative overflow-hidden ring-1 ring-border shadow-sm shrink-0 bg-muted isolate",
|
|
56
|
+
image: "absolute inset-0 h-full w-full !object-cover transition-transform duration-500 group-hover:scale-105 block",
|
|
57
|
+
content: "flex flex-col flex-1",
|
|
58
|
+
title: "font-heading font-bold tracking-tight text-pretty group-hover:text-primary transition-colors",
|
|
59
|
+
description: "text-muted-foreground line-clamp-2 text-base text-pretty",
|
|
60
|
+
footer: "mt-auto flex items-end justify-end w-full",
|
|
61
|
+
authorGroup: "flex flex-col gap-5xs text-xs font-medium text-muted-foreground",
|
|
62
|
+
author: "font-bold text-foreground",
|
|
63
|
+
link: "inline-flex items-center gap-5xs text-sm font-semibold hover:underline decoration-primary underline-offset-4",
|
|
64
|
+
badge: "px-2xs py-6xs rounded-full bg-muted text-muted-foreground text-[10px] font-bold uppercase tracking-wider",
|
|
65
|
+
featuredBadge: "absolute top-3 left-3 z-20 flex items-center gap-5xs px-3xs py-5xs rounded-full bg-primary text-primary-foreground text-[10px] font-bold uppercase tracking-wider shadow-lg ring-1 ring-white/20",
|
|
66
|
+
},
|
|
67
|
+
variants: {
|
|
68
|
+
variant: {
|
|
69
|
+
flat: {
|
|
70
|
+
root: "flex-col md:flex-row gap-3xl md:gap-4xl items-stretch py-4xl first:pt-0 last:pb-0 text-left",
|
|
71
|
+
imageWrapper: "w-full md:w-5/12 aspect-video self-stretch rounded-3xl shrink-0 shadow-none ring-0",
|
|
72
|
+
content: "gap-2xl justify-center items-start text-left",
|
|
73
|
+
title: "text-xl",
|
|
74
|
+
description: "text-base",
|
|
75
|
+
},
|
|
76
|
+
card: {
|
|
77
|
+
root: "flex-col bg-muted/20 p-2xl rounded-3xl border border-border/50 hover:bg-muted/40 hover:shadow-2xl hover:-translate-y-1 gap-2xl text-left items-stretch",
|
|
78
|
+
imageWrapper: "w-full aspect-video rounded-2xl shadow-lg",
|
|
79
|
+
title: "text-xl",
|
|
80
|
+
content: "gap-2xl text-left items-start",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
variant: "flat",
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const { project, variant, class: className, showImage = true, separator = false } = Astro.props;
|
|
90
|
+
|
|
91
|
+
// Detect if this is a CMS document or Astro content entry
|
|
92
|
+
const isCMSDocument = "_id" in project && !("id" in project);
|
|
93
|
+
|
|
94
|
+
// Extract fields based on source type
|
|
95
|
+
const projectTitle = isCMSDocument ? project.title : project.data.title;
|
|
96
|
+
const projectDescription = isCMSDocument ? project.description : project.data.description;
|
|
97
|
+
const projectImage = isCMSDocument ? project.heroImage : project.data.heroImage;
|
|
98
|
+
const projectFeatured = isCMSDocument ? (project.featured ?? false) : project.data.featured;
|
|
99
|
+
const projectTags = isCMSDocument ? (project.tags || []) : (project.data.tags || []);
|
|
100
|
+
|
|
101
|
+
// Handle date formatting
|
|
102
|
+
const rawDate = isCMSDocument ? (project.publishedDate || project._createdAt) : project.data.publishedDate;
|
|
103
|
+
const d = rawDate ? new Date(rawDate) : null;
|
|
104
|
+
const formattedDate = d && !isNaN(d.getTime())
|
|
105
|
+
? new Intl.DateTimeFormat(translationLocale, {
|
|
106
|
+
dateStyle: "medium",
|
|
107
|
+
}).format(d)
|
|
108
|
+
: "";
|
|
109
|
+
|
|
110
|
+
// Get slug from CMS or Astro content
|
|
111
|
+
const projectSlug = isCMSDocument
|
|
112
|
+
? (project.slug || "")
|
|
113
|
+
: project.id.replace(/^(en|pt|de|es|ja)\//, "");
|
|
114
|
+
|
|
115
|
+
const { root, imageWrapper, image, content, title, description, footer, authorGroup, author, link, badge, featuredBadge } = projectPostVariants({ variant });
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
<div class="flex flex-col w-full">
|
|
119
|
+
<a href={`/${translationLocale}/projects/${projectSlug}`} class:list={[root, className]}>
|
|
120
|
+
{showImage && (
|
|
121
|
+
<div class={imageWrapper}>
|
|
122
|
+
{projectFeatured && (
|
|
123
|
+
<div class={featuredBadge}>
|
|
124
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path></svg>
|
|
125
|
+
{t.latest_badge}
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
{projectImage && (
|
|
129
|
+
<Image
|
|
130
|
+
src={projectImage as any}
|
|
131
|
+
alt={projectTitle}
|
|
132
|
+
width={800}
|
|
133
|
+
height={450}
|
|
134
|
+
class={image}
|
|
135
|
+
loading="lazy"
|
|
136
|
+
decoding="async"
|
|
137
|
+
/>
|
|
138
|
+
)}
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
|
|
142
|
+
<div class={content}>
|
|
143
|
+
<h3 class={title}>
|
|
144
|
+
{projectTitle}
|
|
145
|
+
</h3>
|
|
146
|
+
|
|
147
|
+
<div class="flex items-center gap-3xs mt-3xs">
|
|
148
|
+
<Avatar size="sm" variant="primary">
|
|
149
|
+
<AvatarImage image={avatarAsset} alt="Daniel Marchi" />
|
|
150
|
+
</Avatar>
|
|
151
|
+
<div class={authorGroup}>
|
|
152
|
+
<span class={author}>Daniel Marchi</span>
|
|
153
|
+
<div class="flex items-center gap-3xs">
|
|
154
|
+
<span>{formattedDate}</span>
|
|
155
|
+
<div class="flex flex-wrap gap-5xs ml-3xs">
|
|
156
|
+
{Array.isArray(projectTags) && projectTags.map((tag: string) => (
|
|
157
|
+
<span class={badge}>{tag}</span>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<p class={description}>
|
|
165
|
+
{projectDescription}
|
|
166
|
+
</p>
|
|
167
|
+
|
|
168
|
+
<div class={footer}>
|
|
169
|
+
<span class={link}>
|
|
170
|
+
{t.view_project}
|
|
171
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="transition-transform group-hover:translate-x-1"><path d="M5 12h14"></path><path d="m12 5 7 7-7 7"></path></svg>
|
|
172
|
+
</span>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</a>
|
|
176
|
+
|
|
177
|
+
{separator && (
|
|
178
|
+
<div class="py-4xl last:hidden">
|
|
179
|
+
<Separator />
|
|
180
|
+
</div>
|
|
181
|
+
)}
|
|
182
|
+
</div>
|
|
183
|
+
|
|
@@ -1,71 +1,59 @@
|
|
|
1
1
|
---
|
|
2
|
+
import RLAButton from "./astro/RLAButton.astro";
|
|
2
3
|
import IconSun from "~icons/lucide/sun"
|
|
3
4
|
import IconMoon from "~icons/lucide/moon"
|
|
4
|
-
import Toggle from "./toggle/Toggle.astro";
|
|
5
5
|
|
|
6
6
|
export interface ThemeToggleProps {
|
|
7
7
|
class?: string;
|
|
8
8
|
size?: "sm" | "md" | "lg";
|
|
9
9
|
}
|
|
10
|
+
|
|
10
11
|
type Props = ThemeToggleProps;
|
|
11
12
|
|
|
12
|
-
const { class: className, size = "md" } = Astro.props as Props
|
|
13
|
+
const { class: className, size = "md" } = Astro.props as Props
|
|
13
14
|
---
|
|
14
15
|
|
|
15
|
-
<
|
|
16
|
-
id="theme-toggle"
|
|
16
|
+
<RLAButton
|
|
17
17
|
size={size}
|
|
18
18
|
class:list={[
|
|
19
|
+
"theme-toggle-button",
|
|
19
20
|
"group text-muted-foreground hover:text-foreground rounded-full hover:bg-transparent",
|
|
20
21
|
className,
|
|
21
22
|
]}
|
|
22
23
|
variant="ghost"
|
|
23
|
-
className={className}
|
|
24
24
|
aria-label="Toggle theme"
|
|
25
25
|
>
|
|
26
|
-
<IconSun class="sun-wrapper" />
|
|
27
|
-
<IconMoon class="moon-wrapper" />
|
|
28
|
-
</
|
|
29
|
-
|
|
30
|
-
<style>
|
|
31
|
-
#theme-toggle[data-state="on"] .sun-wrapper {
|
|
32
|
-
display: none;
|
|
33
|
-
}
|
|
34
|
-
#theme-toggle[data-state="off"] .sun-wrapper {
|
|
35
|
-
display: flex;
|
|
36
|
-
}
|
|
37
|
-
#theme-toggle[data-state="on"] .moon-wrapper {
|
|
38
|
-
display: flex;
|
|
39
|
-
}
|
|
40
|
-
#theme-toggle[data-state="off"] .moon-wrapper {
|
|
41
|
-
display: none;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
26
|
+
<IconSun class="sun-wrapper block dark:hidden" />
|
|
27
|
+
<IconMoon class="moon-wrapper hidden dark:block" />
|
|
28
|
+
</RLAButton>
|
|
44
29
|
|
|
45
30
|
<script>
|
|
46
31
|
function setupThemeToggle() {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
button.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
32
|
+
const buttons = document.querySelectorAll('.theme-toggle-button');
|
|
33
|
+
|
|
34
|
+
const updateButtons = (isDark: boolean) => {
|
|
35
|
+
buttons.forEach(btn => {
|
|
36
|
+
btn.setAttribute('data-state', isDark ? 'on' : 'off');
|
|
37
|
+
btn.setAttribute('aria-pressed', isDark.toString());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Set initial state
|
|
42
|
+
const currentIsDark = document.documentElement.classList.contains('dark');
|
|
43
|
+
updateButtons(currentIsDark);
|
|
44
|
+
|
|
45
|
+
buttons.forEach(button => {
|
|
46
|
+
button.addEventListener('click', () => {
|
|
47
|
+
const isDark = document.documentElement.classList.toggle('dark');
|
|
48
|
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
|
49
|
+
updateButtons(isDark);
|
|
50
|
+
});
|
|
65
51
|
});
|
|
66
52
|
}
|
|
67
53
|
|
|
68
|
-
//
|
|
54
|
+
// Initial setup
|
|
55
|
+
setupThemeToggle();
|
|
56
|
+
// Re-run on View Transitions
|
|
69
57
|
document.addEventListener('astro:page-load', setupThemeToggle);
|
|
70
58
|
</script>
|
|
71
59
|
|