-
-
Notifications
You must be signed in to change notification settings - Fork 150
Created New Feature Banner and Added to Home Page #2037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ccf9331
Add new transcript feature announcement banner
n1b11 8569e81
Format HeroHeader with Prettier
n1b11 6737806
Remove unused import
n1b11 6a6ebe4
Add Story
n1b11 1410f55
Fix naming issues
n1b11 320bc7c
Implement useLocalStorage hook
n1b11 fbfd1a8
Add translation
n1b11 5051735
Remove local storage redundant code
n1b11 0d3a282
fix spelling issues
n1b11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,45 @@ | ||
| import { Row } from "react-bootstrap" | ||
| import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" | ||
| import { faXmark } from "@fortawesome/free-solid-svg-icons" | ||
| import { useLocalStorage } from "usehooks-ts" | ||
|
|
||
| function AnnouncementBanner({ | ||
| endDate, | ||
| children | ||
| }: { | ||
| endDate: Date | ||
| children: React.ReactElement | ||
| }) { | ||
| const [open, setOpen] = useLocalStorage<boolean>("bannerOpen", true) | ||
|
|
||
| const close = () => { | ||
| setOpen(false) | ||
| } | ||
|
|
||
| const now: Date = new Date() | ||
| if (now < endDate && open) { | ||
| return ( | ||
| <Row | ||
| style={{ zIndex: 100 }} | ||
| className="position-relative h3 text-center text-white p-3 bg-warning" | ||
| > | ||
| <button | ||
| className="position-absolute top-0 end-0 border-0 bg-transparent p-1" | ||
| style={{ width: "auto" }} | ||
| onClick={close} | ||
| > | ||
| <FontAwesomeIcon | ||
| icon={faXmark} | ||
| style={{ color: "white", fontSize: "18px", paddingRight: "8px" }} | ||
| /> | ||
| </button> | ||
|
|
||
| {children} | ||
| </Row> | ||
| ) | ||
| } else { | ||
| return <></> | ||
| } | ||
| } | ||
|
|
||
| export default AnnouncementBanner | ||
This file contains hidden or 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,23 @@ | ||
| import { useTranslation } from "react-i18next" | ||
| import AnnouncementBanner from "./AnnouncementBanner" | ||
|
|
||
| function TranscriptAnnouncement() { | ||
| const { t } = useTranslation("common") | ||
| return ( | ||
| <AnnouncementBanner endDate={new Date("2026-03-01T12:00:00.000Z")}> | ||
| <p className="mb-0"> | ||
| <span className="fw-bold">{t("announcement.headingBold")}</span>{" "} | ||
| <span> | ||
| {t("announcement.headingBody")} | ||
| <br /> | ||
| {t("announcement.description")}{" "} | ||
| <a href="/hearings" style={{ color: "white" }}> | ||
| {t("announcement.link")} | ||
| </a> | ||
| </span> | ||
| </p> | ||
| </AnnouncementBanner> | ||
| ) | ||
| } | ||
|
|
||
| export default TranscriptAnnouncement |
This file contains hidden or 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 hidden or 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
17 changes: 17 additions & 0 deletions
17
stories_hold/organisms/pageElements/AnnouncementBanner.stories.tsx
This file contains hidden or 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,17 @@ | ||
| import { StoryObj } from "@storybook/react" | ||
| import AnnouncementBanner from "components/AnnouncementBanner/AnnouncementBanner" | ||
| import { createMeta } from "stories/utils" | ||
|
|
||
| export default createMeta({ | ||
| title: "components/AnnouncementBanner", | ||
| component: AnnouncementBanner | ||
| }) | ||
|
|
||
| type Story = StoryObj<typeof AnnouncementBanner> | ||
|
|
||
| export const Primary: Story = { | ||
| args: { | ||
| endDate: new Date("2026-03-01T12:00:00.000Z") | ||
| }, | ||
| name: "AnnouncementBanner" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.