Skip to content

Commit ec6d130

Browse files
committed
feat: add Telegram button component to layout
1 parent 9a2594a commit ec6d130

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Footer from '@/components/Footer'
55
import { BackToTop } from '@/components/BackToTop'
66
import EscapeButton from '@/components/EscapeButton'
77
import Overlay from '@/components/Overlay'
8+
import TelegramButton from '@/components/TelegramButton'
89

910
export const metadata: Metadata = {
1011
metadataBase: new URL('https://heretohelp.ir'),
@@ -76,6 +77,7 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
7677
height={1080}
7778
/>
7879
<EscapeButton />
80+
<TelegramButton />
7981
<div className='mx-auto flex min-h-screen max-w-[1100px] flex-col px-4 sm:px-6 lg:px-8'>
8082
{children}
8183
<BackToTop />

components/TelegramButton.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use client'
2+
3+
import Telegram from '@/assets/icons/Telegram'
4+
5+
export default function TelegramButton() {
6+
const telegramUrl = process.env.NEXT_PUBLIC_TG_BOT_URL || 'https://t.me/iran_here_to_help_bot'
7+
8+
const handleClick = () => {
9+
window.open(telegramUrl, '_blank', 'noopener,noreferrer')
10+
}
11+
12+
return (
13+
<button
14+
onClick={handleClick}
15+
className='fixed bottom-4 left-4 z-50 flex h-10 w-10 items-center justify-center rounded-full bg-blue-500 text-white shadow-lg transition-transform hover:scale-110'
16+
aria-label='Open Telegram Bot'
17+
title='ربات تلگرام ما'
18+
>
19+
<Telegram width={20} height={20} />
20+
</button>
21+
)
22+
}

0 commit comments

Comments
 (0)