Skip to content

Commit 008cf6b

Browse files
committed
✨ updated styling of banner
1 parent 9b8b2f5 commit 008cf6b

File tree

3 files changed

+48
-23
lines changed

3 files changed

+48
-23
lines changed

src/app/providers.tsx

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use client'
22

3-
import { Button } from '@/components/mdx'
4-
import { ChevronRight } from 'lucide-react'
3+
import SyntaxUIProBanner from '@/components/SyntaxUIProBanner'
4+
import { useProBannerStore } from '@/store'
5+
import { X } from 'lucide-react'
56
import { ThemeProvider } from 'next-themes'
6-
import { useRouter } from 'next/navigation'
77

88
import posthog from 'posthog-js'
99
import { PostHogProvider } from 'posthog-js/react'
@@ -17,26 +17,9 @@ function CSPostHogProvider({ children }: { children: React.ReactNode }) {
1717
return <PostHogProvider client={posthog}>{children}</PostHogProvider>
1818
}
1919

20-
const SyntaxUIProBanner = () => {
21-
const router = useRouter()
22-
return (
23-
<>
24-
<div
25-
onClick={() => router.push('/pro')}
26-
className={`fixed bottom-0 left-0 right-0 z-50 cursor-pointer transition-all duration-300 ease-in-out`}
27-
>
28-
<div className="flex w-full items-center justify-center gap-x-6 bg-red-500 px-6 py-2 sm:px-3.5">
29-
<div className="flex items-center gap-4 text-sm font-medium leading-6 text-white">
30-
<p>{`Get Premium Blocks and Templates for your next project on SyntaxUI Pro`}</p>
31-
<ChevronRight className="h-4 w-4" />
32-
</div>
33-
</div>
34-
</div>
35-
</>
36-
)
37-
}
38-
3920
export function Providers({ children }: { children: React.ReactNode }) {
21+
const { showProBanner } = useProBannerStore()
22+
4023
return (
4124
<ThemeProvider
4225
attribute="class"
@@ -45,7 +28,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
4528
>
4629
<CSPostHogProvider>
4730
{children}
48-
<SyntaxUIProBanner />
31+
{showProBanner && <SyntaxUIProBanner />}
4932
</CSPostHogProvider>
5033
</ThemeProvider>
5134
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { useProBannerStore } from '@/store'
2+
import { X } from 'lucide-react'
3+
4+
const SyntaxUIProBanner = () => {
5+
const { setShowProBanner } = useProBannerStore()
6+
return (
7+
<div className="border-border group fixed bottom-2 right-2 z-50 h-auto w-[calc(100vw-16px)] max-w-[350px] overflow-hidden rounded-lg border border-red-700 bg-red-500 p-4 text-white transition-all animate-in slide-in-from-bottom-full md:bottom-4 md:right-4">
8+
<a
9+
href="https://pro.syntaxui.com/"
10+
target="_blank"
11+
rel="noopener noreferrer"
12+
>
13+
<div className="flex flex-col items-start gap-0.5">
14+
<h1 className="text-md hidden font-semibold md:block">
15+
Code Less, Create More!
16+
</h1>
17+
<div className="font-regular flex items-start justify-start text-sm leading-6 text-white/80">
18+
{`Get Premium Blocks and Templates for your next project on SyntaxUI Pro ↗`}
19+
</div>
20+
</div>
21+
</a>
22+
<button
23+
className="p-1s absolute right-2 top-2 transition-all duration-300 ease-in-out group-hover:block md:hidden"
24+
onClick={() => setShowProBanner(false)}
25+
>
26+
<X className="h-5 w-5" />
27+
</button>
28+
</div>
29+
)
30+
}
31+
32+
export default SyntaxUIProBanner

src/store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ export const useStarStore = create<StarStore>((set) => ({
99
stars: 100,
1010
setStars: (count) => set({ stars: count }),
1111
}))
12+
13+
interface ProBannerStore {
14+
showProBanner: boolean
15+
setShowProBanner: (show: boolean) => void
16+
}
17+
18+
export const useProBannerStore = create<ProBannerStore>((set) => ({
19+
showProBanner: true,
20+
setShowProBanner: (show) => set({ showProBanner: show }),
21+
}))

0 commit comments

Comments
 (0)