-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(homepage): add preview for announcements component (#1496)
* feat(announcements): add SCSS styles from template * feat(announcements): add frontmatter types * feat(announcements): introduce preview component * chore: sync padding and margin helpers * chore: sync template changes to CMS preview
- Loading branch information
Showing
6 changed files
with
315 additions
and
47 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.announcements-divider { | ||
height: 1px; | ||
color: #f9f9f9; | ||
} | ||
|
||
.announcements-announcement-title { | ||
font-size: 1.625rem; | ||
font-weight: 700; | ||
line-height: 2rem; | ||
} | ||
|
||
.announcements-announcement-subtitle { | ||
font-size: 1rem; | ||
font-weight: 400; | ||
line-height: 1.375rem; | ||
} | ||
|
||
.announcements-announcement-link { | ||
color: var(--site-secondary-color); | ||
font-size: 1.125rem; | ||
font-weight: 600; | ||
line-height: 1.5rem; | ||
letter-spacing: 0.27px; | ||
text-decoration-line: underline; | ||
text-transform: capitalize; | ||
text-underline-offset: 0.25rem; | ||
} | ||
|
||
.announcements-announcement-link:hover { | ||
color: var(--site-secondary-color-hover); | ||
} | ||
|
||
a[target="_blank"].announcements-announcement-link::after { | ||
content: unset; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
@charset 'UTF-8'; | ||
// Minimum width before a media query is triggered | ||
$breakpoints: ( | ||
"": 0px, | ||
sm: 431px, | ||
md: 770px, | ||
lg: 1024px, | ||
xl: 1280px, | ||
xxl: 1408px, | ||
); | ||
|
||
@use "helpers"; | ||
@import "helpers"; | ||
|
||
@import "homepage/announcements"; |
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,168 @@ | ||
import { forwardRef } from "react" | ||
|
||
import editorStyles from "styles/isomer-cms/pages/Editor.module.scss" | ||
|
||
import { getClassNames } from "templates/utils/stylingUtils" | ||
|
||
import { AnnouncementsSection } from "types/homepage" | ||
|
||
type TemplateAnnouncementsSectionProps = Omit< | ||
AnnouncementsSection, | ||
"announcement_items" | ||
> & { | ||
announcementItems: AnnouncementsSection["announcement_items"] | ||
sectionIndex: number | ||
} | ||
|
||
export const TemplateAnnouncementsSection = forwardRef< | ||
HTMLDivElement, | ||
TemplateAnnouncementsSectionProps | ||
>( | ||
( | ||
{ | ||
title, | ||
subtitle, | ||
announcementItems, | ||
sectionIndex, | ||
}: TemplateAnnouncementsSectionProps, | ||
ref | ||
) => { | ||
return ( | ||
<div ref={ref}> | ||
<section | ||
className={getClassNames(editorStyles, [ | ||
`bp-section`, | ||
sectionIndex % 2 === 1 ? "bg-newssection" : "", | ||
"px-14", | ||
"px-md-24", | ||
"py-24", | ||
])} | ||
> | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"bp-container", | ||
"is-fluid", | ||
"m-0", | ||
])} | ||
> | ||
<div className={editorStyles.row}> | ||
<div className={getClassNames(editorStyles, ["col", "is-full"])}> | ||
<> | ||
{subtitle && ( | ||
<p | ||
className={getClassNames(editorStyles, [ | ||
"eyebrow", | ||
"is-uppercase", | ||
"pb-4", | ||
"has-text-centered", | ||
])} | ||
> | ||
{subtitle} | ||
</p> | ||
)} | ||
{title && ( | ||
<h1 | ||
className={getClassNames(editorStyles, [ | ||
"has-text-secondary", | ||
"pb-4", | ||
"has-text-centered", | ||
])} | ||
> | ||
<b>{title}</b> | ||
</h1> | ||
)} | ||
|
||
<hr | ||
className={getClassNames(editorStyles, [ | ||
"my-8", | ||
"announcements-divider", | ||
])} | ||
/> | ||
|
||
{announcementItems && | ||
announcementItems.map((announcement, index) => { | ||
return ( | ||
<> | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"row", | ||
"is-desktop", | ||
])} | ||
> | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"col", | ||
"is-4-desktop", | ||
"px-lg-6", | ||
"mr-lg-6", | ||
])} | ||
> | ||
<h3 | ||
className={getClassNames(editorStyles, [ | ||
"announcements-announcement-title", | ||
"mb-4", | ||
])} | ||
> | ||
<b>{announcement.title}</b> | ||
</h3> | ||
<p | ||
className={ | ||
editorStyles[ | ||
"announcements-announcement-subtitle" | ||
] | ||
} | ||
> | ||
{announcement.date} | ||
</p> | ||
</div> | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"col", | ||
"px-lg-6", | ||
])} | ||
> | ||
<p>{announcement.announcement}</p> | ||
{announcement.link_text && announcement.link_url && ( | ||
<div className={editorStyles["mt-4"]}> | ||
<div | ||
className={ | ||
editorStyles[ | ||
"announcements-announcement-link" | ||
] | ||
} | ||
> | ||
<span>{announcement.link_text}</span> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
{announcementItems && | ||
announcementItems.length === index + 1 ? ( | ||
<hr | ||
className={getClassNames(editorStyles, [ | ||
"mt-8", | ||
"mb-0", | ||
"announcements-divider", | ||
])} | ||
/> | ||
) : ( | ||
<hr | ||
className={getClassNames(editorStyles, [ | ||
"my-8", | ||
"announcements-divider", | ||
])} | ||
/> | ||
)} | ||
</> | ||
) | ||
})} | ||
</> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
) | ||
} | ||
) |
Oops, something went wrong.