@sykoramaros/marosh-components 0.1.17 → 0.2.3
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/cli/index.cjs +513 -537
- package/dist/index.d.ts +27 -46
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5283 -5401
- package/dist/index.mjs.map +1 -1
- package/package.json +43 -27
- package/src/components/basicComponents/CustomButton.stories.tsx +60 -0
- package/src/components/basicComponents/Footer.stories.tsx +47 -0
- package/src/components/basicComponents/Footer.tsx +13 -5
- package/src/components/basicComponents/LanguageSwitcher.stories.tsx +52 -0
- package/src/components/basicComponents/LanguageSwitcher.tsx +84 -0
- package/src/components/basicComponents/MainNav.stories.tsx +34 -0
- package/src/components/basicComponents/MainNav.tsx +24 -6
- package/src/components/basicComponents/MainSidebarLayout.stories.tsx +77 -0
- package/src/components/basicComponents/MainSidebarLayout.tsx +32 -27
- package/src/components/basicComponents/Switcher.stories.tsx +42 -0
- package/src/components/basicComponents/Switcher.tsx +2 -0
- package/src/components/ui/dropdown-menu.tsx +171 -0
- package/src/components/ui/sidebar.tsx +1 -0
- package/src/hooks/use-mobile.ts +5 -6
- package/src/index.ts +6 -7
- package/src/providers/BaseUrlProvider.tsx +1 -1
- package/src/providers/ThemeContextProvider.tsx +14 -2
- package/src/vite-env.d.ts +1 -0
- package/src/App.css +0 -42
- package/src/App.tsx +0 -44
- package/src/config/projectData.ts +0 -122
- package/src/main.tsx +0 -23
- package/src/providers/ProjectDataProvider.tsx +0 -26
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
SidebarTrigger,
|
|
11
11
|
SidebarProvider,
|
|
12
12
|
} from "@/components/ui/sidebar"
|
|
13
|
-
import {
|
|
14
|
-
import { MainNav, type NavItem } from "@/components/basicComponents/MainNav"
|
|
13
|
+
import { MainNav, type NavItem, type LinkComponentProps } from "@/components/basicComponents/MainNav"
|
|
15
14
|
import { Footer, type FooterItems } from "@/components/basicComponents/Footer"
|
|
16
15
|
|
|
17
16
|
export interface MainSidebarLayoutProps {
|
|
@@ -23,6 +22,7 @@ export interface MainSidebarLayoutProps {
|
|
|
23
22
|
footerItems?: FooterItems
|
|
24
23
|
sidebarDefaultOpen?: boolean
|
|
25
24
|
children?: React.ReactNode
|
|
25
|
+
LinkComponent?: React.ComponentType<LinkComponentProps>
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export const MainSidebarLayout = ({
|
|
@@ -33,25 +33,21 @@ export const MainSidebarLayout = ({
|
|
|
33
33
|
navItems = [],
|
|
34
34
|
footerItems,
|
|
35
35
|
sidebarDefaultOpen = true,
|
|
36
|
+
children,
|
|
37
|
+
LinkComponent,
|
|
36
38
|
}: MainSidebarLayoutProps) => {
|
|
37
|
-
// Layout bez sidebaru
|
|
38
39
|
if (!useSidebar) {
|
|
39
40
|
return (
|
|
40
41
|
<div className="flex-1 flex min-h-screen flex-col">
|
|
41
|
-
{useMainNav && <MainNav navItems={navItems} />}
|
|
42
|
+
{useMainNav && <MainNav navItems={navItems} LinkComponent={LinkComponent} />}
|
|
42
43
|
<main className="flex-1 p-5">
|
|
43
|
-
|
|
44
|
+
{children}
|
|
44
45
|
</main>
|
|
45
|
-
{useFooter && footerItems &&
|
|
46
|
-
<footer>
|
|
47
|
-
<Footer {...footerItems} />
|
|
48
|
-
</footer>
|
|
49
|
-
)}
|
|
46
|
+
{useFooter && footerItems && <Footer {...footerItems} LinkComponent={LinkComponent} />}
|
|
50
47
|
</div>
|
|
51
48
|
)
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
// Layout se sidebarem
|
|
55
51
|
return (
|
|
56
52
|
<SidebarProvider defaultOpen={sidebarDefaultOpen}>
|
|
57
53
|
<div className="flex min-h-screen w-full">
|
|
@@ -66,16 +62,29 @@ export const MainSidebarLayout = ({
|
|
|
66
62
|
{navItems.map((item) => (
|
|
67
63
|
<SidebarMenuItem key={item.title}>
|
|
68
64
|
<SidebarMenuButton asChild>
|
|
69
|
-
|
|
70
|
-
{item.
|
|
71
|
-
|
|
72
|
-
<
|
|
65
|
+
{LinkComponent ? (
|
|
66
|
+
<LinkComponent to={item.url}>
|
|
67
|
+
{item.icon && (
|
|
68
|
+
<span className="inline-flex h-5 w-5 shrink-0 items-center">
|
|
69
|
+
<item.icon className="h-full w-full" />
|
|
70
|
+
</span>
|
|
71
|
+
)}
|
|
72
|
+
<span className="text-base font-medium">
|
|
73
|
+
{item.title}
|
|
73
74
|
</span>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
</LinkComponent>
|
|
76
|
+
) : (
|
|
77
|
+
<a href={item.url}>
|
|
78
|
+
{item.icon && (
|
|
79
|
+
<span className="inline-flex h-5 w-5 shrink-0 items-center">
|
|
80
|
+
<item.icon className="h-full w-full" />
|
|
81
|
+
</span>
|
|
82
|
+
)}
|
|
83
|
+
<span className="text-base font-medium">
|
|
84
|
+
{item.title}
|
|
85
|
+
</span>
|
|
86
|
+
</a>
|
|
87
|
+
)}
|
|
79
88
|
</SidebarMenuButton>
|
|
80
89
|
</SidebarMenuItem>
|
|
81
90
|
))}
|
|
@@ -88,18 +97,14 @@ export const MainSidebarLayout = ({
|
|
|
88
97
|
<div className="flex-1 flex flex-col">
|
|
89
98
|
<header className="sticky top-0 z-10 flex items-center border-b bg-background px-4 h-14 gap-2">
|
|
90
99
|
<SidebarTrigger />
|
|
91
|
-
{useMainNav && <MainNav navItems={navItems} />}
|
|
100
|
+
{useMainNav && <MainNav navItems={navItems} LinkComponent={LinkComponent} />}
|
|
92
101
|
</header>
|
|
93
102
|
|
|
94
103
|
<main className="flex-1 p-6">
|
|
95
|
-
|
|
104
|
+
{children}
|
|
96
105
|
</main>
|
|
97
106
|
|
|
98
|
-
{useFooter && footerItems &&
|
|
99
|
-
<footer>
|
|
100
|
-
<Footer {...footerItems} />
|
|
101
|
-
</footer>
|
|
102
|
-
)}
|
|
107
|
+
{useFooter && footerItems && <Footer {...footerItems} LinkComponent={LinkComponent} />}
|
|
103
108
|
</div>
|
|
104
109
|
</div>
|
|
105
110
|
</SidebarProvider>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/tanstack-react"
|
|
2
|
+
import { Moon, Sun } from "lucide-react"
|
|
3
|
+
import { Switcher } from "./Switcher"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Switcher> = {
|
|
6
|
+
title: "Components/Switcher",
|
|
7
|
+
component: Switcher,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
checked: { control: "boolean" },
|
|
11
|
+
disabled: { control: "boolean" },
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof Switcher>
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: { checked: false },
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Checked: Story = {
|
|
23
|
+
args: { checked: true },
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const WithIcon: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
checked: false,
|
|
29
|
+
icon: <Moon className="h-3 w-3" />,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const WithIconChecked: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
checked: true,
|
|
36
|
+
icon: <Sun className="h-3 w-3" />,
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Disabled: Story = {
|
|
41
|
+
args: { checked: false, disabled: true },
|
|
42
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
3
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
7
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
8
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
9
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
10
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
11
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
12
|
+
|
|
13
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }
|
|
16
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
17
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
21
|
+
inset && "pl-8",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
<ChevronRight className="ml-auto" />
|
|
28
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
29
|
+
))
|
|
30
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName
|
|
31
|
+
|
|
32
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<DropdownMenuPrimitive.SubContent
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
))
|
|
45
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName
|
|
46
|
+
|
|
47
|
+
const DropdownMenuContent = React.forwardRef<
|
|
48
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
50
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
51
|
+
<DropdownMenuPrimitive.Portal>
|
|
52
|
+
<DropdownMenuPrimitive.Content
|
|
53
|
+
ref={ref}
|
|
54
|
+
sideOffset={sideOffset}
|
|
55
|
+
className={cn(
|
|
56
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
</DropdownMenuPrimitive.Portal>
|
|
62
|
+
))
|
|
63
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
64
|
+
|
|
65
|
+
const DropdownMenuItem = React.forwardRef<
|
|
66
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
67
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
|
|
68
|
+
>(({ className, inset, ...props }, ref) => (
|
|
69
|
+
<DropdownMenuPrimitive.Item
|
|
70
|
+
ref={ref}
|
|
71
|
+
className={cn(
|
|
72
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
73
|
+
inset && "pl-8",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
))
|
|
79
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
80
|
+
|
|
81
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
82
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
83
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
84
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
85
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn(
|
|
88
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
89
|
+
className
|
|
90
|
+
)}
|
|
91
|
+
checked={checked}
|
|
92
|
+
{...props}
|
|
93
|
+
>
|
|
94
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
95
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
96
|
+
<Check className="h-4 w-4" />
|
|
97
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
98
|
+
</span>
|
|
99
|
+
{children}
|
|
100
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
101
|
+
))
|
|
102
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName
|
|
103
|
+
|
|
104
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
105
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
106
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
107
|
+
>(({ className, children, ...props }, ref) => (
|
|
108
|
+
<DropdownMenuPrimitive.RadioItem
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={cn(
|
|
111
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
112
|
+
className
|
|
113
|
+
)}
|
|
114
|
+
{...props}
|
|
115
|
+
>
|
|
116
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
117
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
118
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
119
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
120
|
+
</span>
|
|
121
|
+
{children}
|
|
122
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
123
|
+
))
|
|
124
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
125
|
+
|
|
126
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
127
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
128
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }
|
|
129
|
+
>(({ className, inset, ...props }, ref) => (
|
|
130
|
+
<DropdownMenuPrimitive.Label
|
|
131
|
+
ref={ref}
|
|
132
|
+
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
|
|
133
|
+
{...props}
|
|
134
|
+
/>
|
|
135
|
+
))
|
|
136
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
137
|
+
|
|
138
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
139
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
140
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
141
|
+
>(({ className, ...props }, ref) => (
|
|
142
|
+
<DropdownMenuPrimitive.Separator
|
|
143
|
+
ref={ref}
|
|
144
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
))
|
|
148
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
149
|
+
|
|
150
|
+
const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (
|
|
151
|
+
<span className={cn("ml-auto text-xs tracking-widest opacity-60", className)} {...props} />
|
|
152
|
+
)
|
|
153
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
DropdownMenu,
|
|
157
|
+
DropdownMenuTrigger,
|
|
158
|
+
DropdownMenuContent,
|
|
159
|
+
DropdownMenuItem,
|
|
160
|
+
DropdownMenuCheckboxItem,
|
|
161
|
+
DropdownMenuRadioItem,
|
|
162
|
+
DropdownMenuLabel,
|
|
163
|
+
DropdownMenuSeparator,
|
|
164
|
+
DropdownMenuShortcut,
|
|
165
|
+
DropdownMenuGroup,
|
|
166
|
+
DropdownMenuPortal,
|
|
167
|
+
DropdownMenuSub,
|
|
168
|
+
DropdownMenuSubContent,
|
|
169
|
+
DropdownMenuSubTrigger,
|
|
170
|
+
DropdownMenuRadioGroup,
|
|
171
|
+
}
|
package/src/hooks/use-mobile.ts
CHANGED
|
@@ -3,17 +3,16 @@ import * as React from "react"
|
|
|
3
3
|
const MOBILE_BREAKPOINT = 768
|
|
4
4
|
|
|
5
5
|
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState
|
|
6
|
+
const [isMobile, setIsMobile] = React.useState(
|
|
7
|
+
() => window.innerWidth < MOBILE_BREAKPOINT,
|
|
8
|
+
)
|
|
7
9
|
|
|
8
10
|
React.useEffect(() => {
|
|
9
11
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
-
const onChange = () =>
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
-
}
|
|
12
|
+
const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
13
13
|
mql.addEventListener("change", onChange)
|
|
14
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
14
|
return () => mql.removeEventListener("change", onChange)
|
|
16
15
|
}, [])
|
|
17
16
|
|
|
18
|
-
return
|
|
17
|
+
return isMobile
|
|
19
18
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { cn } from "@/lib/utils.ts"
|
|
2
|
-
export { Link } from "@tanstack/react-router"
|
|
3
2
|
|
|
4
3
|
// COMPONENTS
|
|
5
4
|
|
|
@@ -11,6 +10,7 @@ export {
|
|
|
11
10
|
MainNav,
|
|
12
11
|
type NavItem,
|
|
13
12
|
type MainNavProps,
|
|
13
|
+
type LinkComponentProps,
|
|
14
14
|
} from "@/components/basicComponents/MainNav"
|
|
15
15
|
export {
|
|
16
16
|
Footer,
|
|
@@ -23,6 +23,11 @@ export {
|
|
|
23
23
|
type MainSidebarLayoutProps,
|
|
24
24
|
} from "@/components/basicComponents/MainSidebarLayout"
|
|
25
25
|
export { Switcher } from "@/components/basicComponents/Switcher"
|
|
26
|
+
export {
|
|
27
|
+
LanguageSwitcher,
|
|
28
|
+
type Language,
|
|
29
|
+
type LanguageSwitcherProps,
|
|
30
|
+
} from "@/components/basicComponents/LanguageSwitcher"
|
|
26
31
|
|
|
27
32
|
// PROVIDERS
|
|
28
33
|
export {
|
|
@@ -31,12 +36,6 @@ export {
|
|
|
31
36
|
type BaseUrlProviderProps,
|
|
32
37
|
} from "@/providers/BaseUrlProvider"
|
|
33
38
|
|
|
34
|
-
export {
|
|
35
|
-
ProjectProvider,
|
|
36
|
-
useProject,
|
|
37
|
-
type ProjectProviderProps,
|
|
38
|
-
} from "@/providers/ProjectDataProvider"
|
|
39
|
-
|
|
40
39
|
export {
|
|
41
40
|
ThemeContextProvider,
|
|
42
41
|
useThemeContext,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/providers/ThemeContextProvider.tsx
|
|
2
|
-
import React, { createContext, useContext, useEffect, useState } from "react"
|
|
2
|
+
import React, { createContext, useContext, useEffect, useRef, useState } from "react"
|
|
3
3
|
|
|
4
4
|
// Typy - EXPORTUJ JE!
|
|
5
5
|
export type ThemeMode = "light" | "dark"
|
|
@@ -12,7 +12,7 @@ export interface ThemeConfig {
|
|
|
12
12
|
dark: Record<string, string>
|
|
13
13
|
}
|
|
14
14
|
css?: {
|
|
15
|
-
"@layer base"?: Record<string,
|
|
15
|
+
"@layer base"?: Record<string, Record<string, string>>
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -57,6 +57,7 @@ export const ThemeContextProvider = ({
|
|
|
57
57
|
|
|
58
58
|
const [isDarkMode, setIsDarkMode] = useState(defaultMode === "dark")
|
|
59
59
|
const [themeName, setThemeName] = useState<string>(initialTheme)
|
|
60
|
+
const appliedVarsRef = useRef<string[]>([])
|
|
60
61
|
|
|
61
62
|
const mode: ThemeMode = isDarkMode ? "dark" : "light"
|
|
62
63
|
|
|
@@ -68,16 +69,27 @@ export const ThemeContextProvider = ({
|
|
|
68
69
|
return
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
// Smazat CSS proměnné předchozího tématu
|
|
73
|
+
appliedVarsRef.current.forEach((key) => {
|
|
74
|
+
document.documentElement.style.removeProperty(key)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const newKeys: string[] = []
|
|
78
|
+
|
|
71
79
|
// Aplikovat CSS proměnné pro mode (light/dark)
|
|
72
80
|
Object.entries(theme.cssVars[mode] || {}).forEach(([key, value]) => {
|
|
73
81
|
document.documentElement.style.setProperty(`--${key}`, value)
|
|
82
|
+
newKeys.push(`--${key}`)
|
|
74
83
|
})
|
|
75
84
|
|
|
76
85
|
// Aplikovat CSS proměnné z theme (včetně fontů)
|
|
77
86
|
Object.entries(theme.cssVars.theme || {}).forEach(([key, value]) => {
|
|
78
87
|
document.documentElement.style.setProperty(`--${key}`, value)
|
|
88
|
+
newKeys.push(`--${key}`)
|
|
79
89
|
})
|
|
80
90
|
|
|
91
|
+
appliedVarsRef.current = newKeys
|
|
92
|
+
|
|
81
93
|
// Vytvořit a přidat @layer base styly
|
|
82
94
|
const styleId = "theme-base-styles"
|
|
83
95
|
let styleElement = document.getElementById(styleId) as HTMLStyleElement
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/src/App.css
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* #root {
|
|
2
|
-
max-width: 1280px;
|
|
3
|
-
margin: 0 auto;
|
|
4
|
-
padding: 2rem;
|
|
5
|
-
text-align: center;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.logo {
|
|
9
|
-
height: 6em;
|
|
10
|
-
padding: 1.5em;
|
|
11
|
-
will-change: filter;
|
|
12
|
-
transition: filter 300ms;
|
|
13
|
-
}
|
|
14
|
-
.logo:hover {
|
|
15
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
|
16
|
-
}
|
|
17
|
-
.logo.react:hover {
|
|
18
|
-
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes logo-spin {
|
|
22
|
-
from {
|
|
23
|
-
transform: rotate(0deg);
|
|
24
|
-
}
|
|
25
|
-
to {
|
|
26
|
-
transform: rotate(360deg);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
31
|
-
a:nth-of-type(2) .logo {
|
|
32
|
-
animation: logo-spin infinite 20s linear;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.card {
|
|
37
|
-
padding: 2em;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.read-the-docs {
|
|
41
|
-
color: #888;
|
|
42
|
-
} */
|
package/src/App.tsx
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Button } from "@/components/ui/button"
|
|
2
|
-
import { CustomButton } from "@/components/basicComponents/CustomButton"
|
|
3
|
-
import { MainNav } from "@/components/basicComponents/MainNav"
|
|
4
|
-
import { Github, Menu, Twitter } from "lucide-react"
|
|
5
|
-
import { Footer } from "@/components/basicComponents/Footer"
|
|
6
|
-
|
|
7
|
-
export const App = () => {
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
<MainNav
|
|
11
|
-
navItems={[
|
|
12
|
-
{ title: "Home", url: "/", icon: Menu },
|
|
13
|
-
{ title: "About", url: "/about", icon: Menu },
|
|
14
|
-
{ title: "Contact", url: "/contact", icon: Menu },
|
|
15
|
-
]}
|
|
16
|
-
/>
|
|
17
|
-
<div className="p-13 flex gap-5">
|
|
18
|
-
<Button>Shadcn UI Test</Button>
|
|
19
|
-
<CustomButton>Custom Button</CustomButton>
|
|
20
|
-
</div>
|
|
21
|
-
<Footer
|
|
22
|
-
className="fixed bottom-0 w-full"
|
|
23
|
-
links={[
|
|
24
|
-
{ title: "Home", url: "/" },
|
|
25
|
-
{ title: "About", url: "/about" },
|
|
26
|
-
{ title: "Contact", url: "/contact" },
|
|
27
|
-
]}
|
|
28
|
-
socialProfiles={[
|
|
29
|
-
{
|
|
30
|
-
title: "Twitter",
|
|
31
|
-
url: "https://twitter.com/shadcn",
|
|
32
|
-
icon: Twitter,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
title: "GitHub",
|
|
36
|
-
url: "https://github.com/shadcn",
|
|
37
|
-
icon: Github,
|
|
38
|
-
},
|
|
39
|
-
]}
|
|
40
|
-
copyright="© 2026 Marosh Sykora"
|
|
41
|
-
/>
|
|
42
|
-
</>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Home,
|
|
3
|
-
FolderOpenDot,
|
|
4
|
-
SmilePlus,
|
|
5
|
-
MessageSquareMore,
|
|
6
|
-
Facebook,
|
|
7
|
-
Linkedin,
|
|
8
|
-
Info,
|
|
9
|
-
Gitlab,
|
|
10
|
-
} from "lucide-react"
|
|
11
|
-
import type { LucideIcon } from "lucide-react"
|
|
12
|
-
|
|
13
|
-
export interface ProjectData {
|
|
14
|
-
appName: string
|
|
15
|
-
navItems: NavItem[]
|
|
16
|
-
footerItems: FooterItem
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface NavItem {
|
|
20
|
-
title: string
|
|
21
|
-
url: string
|
|
22
|
-
icon: LucideIcon
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface FooterItem {
|
|
26
|
-
links: Link[]
|
|
27
|
-
socialProfiles: SocialProfile[]
|
|
28
|
-
copyright: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface Link {
|
|
32
|
-
title: string
|
|
33
|
-
url: string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface SocialProfile {
|
|
37
|
-
title: string
|
|
38
|
-
url: string
|
|
39
|
-
icon: LucideIcon
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const projectData: ProjectData = {
|
|
43
|
-
appName: "Frontend App Template",
|
|
44
|
-
navItems: [
|
|
45
|
-
{
|
|
46
|
-
title: "Home",
|
|
47
|
-
url: "/",
|
|
48
|
-
icon: Home,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
title: "About",
|
|
52
|
-
url: "/portfolio/about",
|
|
53
|
-
icon: Info,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
title: "Skills",
|
|
57
|
-
url: "/portfolio/skills",
|
|
58
|
-
icon: SmilePlus,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: "Projects",
|
|
62
|
-
url: "/portfolio/projects",
|
|
63
|
-
icon: FolderOpenDot,
|
|
64
|
-
},
|
|
65
|
-
// {
|
|
66
|
-
// title: "Hobbies",
|
|
67
|
-
// url: "/portfolio/hobbies",
|
|
68
|
-
// icon: FerrisWheel,
|
|
69
|
-
// },
|
|
70
|
-
{
|
|
71
|
-
title: "Contact",
|
|
72
|
-
url: "/portfolio/contact",
|
|
73
|
-
icon: MessageSquareMore,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
footerItems: {
|
|
77
|
-
links: [
|
|
78
|
-
{
|
|
79
|
-
title: "Home",
|
|
80
|
-
url: "/",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
title: "Contact",
|
|
84
|
-
url: "/portfolio/contact",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
title: "Services",
|
|
88
|
-
url: "/portfolio/services",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
title: "About",
|
|
92
|
-
url: "/portfolio/about",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
title: "Terms",
|
|
96
|
-
url: "/portfolio/terms",
|
|
97
|
-
},
|
|
98
|
-
// {
|
|
99
|
-
// title: "Privacy Policy",
|
|
100
|
-
// url: "/privacy-policy",
|
|
101
|
-
// },
|
|
102
|
-
],
|
|
103
|
-
copyright: "Copyright Marosh ©" + new Date().getFullYear(),
|
|
104
|
-
socialProfiles: [
|
|
105
|
-
{
|
|
106
|
-
title: "Facebook",
|
|
107
|
-
url: "https://facebook.com/",
|
|
108
|
-
icon: Facebook,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
title: "Gitlab",
|
|
112
|
-
url: "https://gitlab.com/",
|
|
113
|
-
icon: Gitlab,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
title: "LinkedIn",
|
|
117
|
-
url: "https://www.linkedin.com/",
|
|
118
|
-
icon: Linkedin,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
}
|