-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #320 from Trendyol/announcement-banner
chore: announcement banner add
- Loading branch information
Showing
7 changed files
with
248 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
gurubu-client/src/app/components/room/grooming-navbar/announcement-banner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { useGroomingRoom } from '@/contexts/GroomingRoomContext'; | ||
import { useState, useEffect } from 'react'; | ||
|
||
const announcements = [ | ||
{ | ||
id: 1, | ||
icon: "✨", | ||
text: "Hey there! We'd love to hear your thoughts on our new Jira design. Your feedback shapes our future!", | ||
buttonText: "Share Thoughts", | ||
link: process.env.NEXT_PUBLIC_FEEDBACK_SHEET_LINK, | ||
}, | ||
{ | ||
id: 3, | ||
icon: "💡", | ||
text: "Got ideas for making GuruBu better? We're all ears!", | ||
buttonText: "Give Feedback", | ||
link: process.env.NEXT_PUBLIC_FEEDBACK_SHEET_LINK, | ||
} | ||
]; | ||
|
||
const AnnouncementBanner = () => { | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
const [isAnimating, setIsAnimating] = useState(false); | ||
const { isAnnouncementBannerVisible, setIsAnnouncementBannerVisible } = useGroomingRoom(); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setIsAnimating(true); | ||
setTimeout(() => { | ||
setCurrentIndex((prev) => (prev + 1) % announcements.length); | ||
setIsAnimating(false); | ||
}, 500); // Animation duration | ||
}, 5000); // Change announcement every 10 seconds | ||
|
||
return () => clearInterval(interval); | ||
}, []); | ||
|
||
if (!isAnnouncementBannerVisible) { | ||
return null; | ||
} | ||
|
||
const currentAnnouncement = announcements[currentIndex]; | ||
|
||
const handleActionClick = () => { | ||
window.open(currentAnnouncement.link, '_blank'); | ||
setIsAnnouncementBannerVisible(false); | ||
}; | ||
|
||
return ( | ||
<div className="announcement-banner"> | ||
<div className="announcement-banner__content"> | ||
<div className={`announcement-banner__icon ${isAnimating ? 'animate-out' : ''}`}> | ||
{currentAnnouncement.icon} | ||
</div> | ||
<p className={`announcement-banner__text ${isAnimating ? 'animate-out' : ''}`}> | ||
{currentAnnouncement.text} | ||
</p> | ||
<button | ||
className={`announcement-banner__button ${isAnimating ? 'animate-out' : ''}`} | ||
onClick={handleActionClick} | ||
> | ||
{currentAnnouncement.buttonText} | ||
</button> | ||
<button | ||
className="announcement-banner__close" | ||
onClick={() => setIsAnnouncementBannerVisible(false)} | ||
aria-label="Close announcement" | ||
> | ||
× | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AnnouncementBanner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
gurubu-client/src/app/styles/room/grooming-navbar/announcement-banner.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
.announcement-banner { | ||
background: linear-gradient(90deg, $primary-600 0%, $primary-700 100%); | ||
padding: 10px 0; | ||
width: 100%; | ||
overflow: hidden; | ||
position: relative; | ||
|
||
&__content { | ||
max-width: 1200px; | ||
margin: 0 auto; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 10px; | ||
padding: 0 24px; | ||
position: relative; | ||
} | ||
|
||
&__close { | ||
background: none; | ||
border: none; | ||
color: rgba($white, 0.8); | ||
font-size: 20px; | ||
line-height: 1; | ||
padding: 4px 6px; | ||
cursor: pointer; | ||
position: absolute; | ||
right: 24px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
transition: color 0.2s ease; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
&:hover { | ||
color: $white; | ||
} | ||
} | ||
|
||
&__icon { | ||
font-size: 14px; | ||
transition: transform 0.5s ease, opacity 0.5s ease; | ||
transform-origin: center; | ||
|
||
&.animate-out { | ||
transform: translateY(-20px); | ||
opacity: 0; | ||
} | ||
|
||
&:not(.animate-out) { | ||
animation: slideIn 0.5s ease; | ||
} | ||
} | ||
|
||
&__text { | ||
color: $white; | ||
font-size: $font-size-paragraph-4; | ||
font-weight: $medium; | ||
letter-spacing: 0.2px; | ||
margin: 0; | ||
transition: transform 0.5s ease, opacity 0.5s ease; | ||
transform-origin: center; | ||
|
||
&.animate-out { | ||
transform: translateY(-20px); | ||
opacity: 0; | ||
} | ||
|
||
&:not(.animate-out) { | ||
animation: slideIn 0.5s ease; | ||
} | ||
} | ||
|
||
&__button { | ||
background-color: $white; | ||
color: $primary-700; | ||
border: none; | ||
padding: 4px 10px; | ||
border-radius: $radius-medium; | ||
font-size: $font-size-paragraph-5; | ||
font-weight: $semibold; | ||
cursor: pointer; | ||
white-space: nowrap; | ||
transition: transform 0.5s ease, opacity 0.5s ease, background-color 0.2s ease; | ||
transform-origin: center; | ||
|
||
&.animate-out { | ||
transform: translateY(-20px); | ||
opacity: 0; | ||
} | ||
|
||
&:not(.animate-out) { | ||
animation: slideIn 0.5s ease; | ||
} | ||
|
||
&:hover { | ||
background-color: rgba($white, 0.9); | ||
transform: translateY(-1px); | ||
} | ||
} | ||
} | ||
|
||
@keyframes slideIn { | ||
from { | ||
transform: translateY(20px); | ||
opacity: 0; | ||
} | ||
to { | ||
transform: translateY(0); | ||
opacity: 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters