Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ const announcements = [
}
];

const AnnouncementBanner = () => {
interface AnnouncementBannerProps {
onClose?: () => void;
}

const AnnouncementBanner = ({ onClose }: AnnouncementBannerProps) => {
const [currentIndex, setCurrentIndex] = useState(0);
const [isAnimating, setIsAnimating] = useState(false);
const [isClosed, setIsClosed] = useState(false);

useEffect(() => {
const interval = setInterval(() => {
Expand All @@ -40,6 +45,15 @@ const AnnouncementBanner = () => {
window.open(currentAnnouncement.link, '_blank');
};

const handleClose = () => {
setIsClosed(true);
onClose?.();
};

if (isClosed) {
return null;
}

return (
<div className="announcement-banner">
<div className="announcement-banner__content">
Expand All @@ -56,6 +70,13 @@ const AnnouncementBanner = () => {
{currentAnnouncement.buttonText}
</button>
</div>
<button
className="announcement-banner__close"
onClick={handleClose}
aria-label="Close announcement"
>
</button>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import classNames from "classnames";

const GroomingFooter = () => {
const currentDate = new Date().getFullYear();
const { jiraSidebarExpanded } = useGroomingRoom();
const { jiraSidebarExpanded, isAnnouncementBannerVisible } = useGroomingRoom();

return (
<footer className={classNames("grooming-footer", {"jira-sidebar-expanded": jiraSidebarExpanded})}>
<footer className={classNames("grooming-footer", {"jira-sidebar-expanded": jiraSidebarExpanded, "banner-closed": !isAnnouncementBannerVisible})}>
<div className="grooming-footer__content">
<div className="grooming-footer__content-copyright">
© 2023 - {currentDate} GuruBu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const GroomingNavbar = ({ showNickNameForm, roomId }: Props) => {
setModalOpen(false);
};

const { groomingInfo, roomStatus, userInfo, jiraSidebarExpanded } = useGroomingRoom();
const { groomingInfo, roomStatus, userInfo, jiraSidebarExpanded, setIsAnnouncementBannerVisible } = useGroomingRoom();
const [isGroomingLinkCopied, setIsGroomingLinkCopied] = useState(false);

const isVotingWindowVisible = groomingInfo?.issues && groomingInfo?.issues?.length > 0;
Expand Down Expand Up @@ -73,7 +73,7 @@ const GroomingNavbar = ({ showNickNameForm, roomId }: Props) => {

return (
<>
<AnnouncementBanner />
<AnnouncementBanner onClose={() => setIsAnnouncementBannerVisible(false)} />
<nav className={classNames("grooming-navbar", { "grooming-navbar--nickname-form": showNickNameForm })}>
<div className={classNames("grooming-navbar__content", { "jira-sidebar-expanded": jiraSidebarExpanded })}>
<Logo />
Expand Down
20 changes: 20 additions & 0 deletions gurubu-client/src/app/styles/common/announcement-banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@
}
}

&__close {
position: absolute;
right: 24px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: $white;
font-size: 14px;
cursor: pointer;
padding: 4px;
line-height: 1;
opacity: 0.7;
transition: opacity 0.2s ease;

&:hover {
opacity: 1;
}
}

&__button {
background-color: $white;
color: $primary-700;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
position: relative;
background-color: #ffffff;
margin-top: 10px;
&.banner-closed {
margin-top: 0;
}
&.jira-sidebar-expanded{
margin-inline: 0;
justify-content: start;
Expand Down
Loading