Skip to content

Commit

Permalink
feat: add priority prop (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
cade-exygy authored Nov 18, 2024
1 parent c5c78be commit 17f214c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/page_components/listing/listing_sidebar/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface ContactProps {
contactTitleClassname?: string
/** The text for the section's header */
sectionTitle: string
/** The header level for the sectionTitle */
priority?: number
strings: { email?: string; getDirections: string; website?: string }
}

Expand All @@ -40,6 +42,7 @@ const Contact = ({
contactTitle,
contactTitleClassname,
sectionTitle,
priority,
strings,
}: ContactProps) => {
const formattedPhoneLink = contactPhoneNumber
Expand All @@ -54,7 +57,7 @@ const Contact = ({

return (
<section className="aside-block">
<Heading priority={4} styleType={"underlineWeighted"}>
<Heading priority={priority ?? 4} styleType={"underlineWeighted"}>
{sectionTitle}
</Heading>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Heading } from "../../../text/Heading"
export interface ExpandableSectionProps {
content: string | React.ReactNode
expandableContent?: string | React.ReactNode
priority?: number
strings: {
title: string
readMore?: string
Expand All @@ -14,7 +15,12 @@ export interface ExpandableSectionProps {
}
}

const ExpandableSection = ({ content, expandableContent, strings }: ExpandableSectionProps) => {
const ExpandableSection = ({
content,
expandableContent,
priority,
strings,
}: ExpandableSectionProps) => {
if (!content) return null

const getTextContent = (textContent: string | React.ReactNode) => {
Expand All @@ -30,7 +36,7 @@ const ExpandableSection = ({ content, expandableContent, strings }: ExpandableSe
}
return (
<section className="aside-block">
<Heading priority={4} styleType={"underlineWeighted"}>
<Heading priority={priority ?? 4} styleType={"underlineWeighted"}>
{strings.title}
</Heading>
<div className="text-sm text-gray-750">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type EventSectionProps = {
headerText?: string
sectionHeader?: boolean
dateClassName?: string
priority?: number
}

const EventSection = (props: EventSectionProps) => {
Expand All @@ -29,7 +30,7 @@ const EventSection = (props: EventSectionProps) => {
<section className="aside-block">
{props.headerText && (
<Heading
priority={4}
priority={props.priority ?? 4}
styleType={props.sectionHeader ? "underlineWeighted" : "capsWeighted"}
>
{props.headerText}
Expand Down

0 comments on commit 17f214c

Please sign in to comment.