|
|
@ -1,18 +1,9 @@ |
|
|
|
import { Database, X } from 'lucide-react'; |
|
|
|
import { Database, X } from 'lucide-react'; |
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
const HIDE_STORAGE_KEY = 'sql-course-announcement-hidden'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function CourseAnnouncement() { |
|
|
|
export function CourseAnnouncement() { |
|
|
|
const [isVisible, setIsVisible] = useState(true); |
|
|
|
const [isVisible, setIsVisible] = useState(true); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
const isHidden = localStorage.getItem(HIDE_STORAGE_KEY) === 'true'; |
|
|
|
|
|
|
|
if (isHidden) { |
|
|
|
|
|
|
|
setIsVisible(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isVisible) { |
|
|
|
if (!isVisible) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -42,7 +33,6 @@ export function CourseAnnouncement() { |
|
|
|
type="button" |
|
|
|
type="button" |
|
|
|
className="absolute right-3.5 top-1/2 -translate-y-1/2 rounded-lg px-1.5 py-1.5 text-gray-500 hover:bg-yellow-500 hover:text-gray-700" |
|
|
|
className="absolute right-3.5 top-1/2 -translate-y-1/2 rounded-lg px-1.5 py-1.5 text-gray-500 hover:bg-yellow-500 hover:text-gray-700" |
|
|
|
onClick={(e) => { |
|
|
|
onClick={(e) => { |
|
|
|
localStorage.setItem(HIDE_STORAGE_KEY, 'true'); |
|
|
|
|
|
|
|
setIsVisible(false); |
|
|
|
setIsVisible(false); |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|