Skip to content

Commit

Permalink
refactor and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
choden-dev committed Nov 12, 2024
1 parent 0112c84 commit a355b38
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
10 changes: 9 additions & 1 deletion client/src/app/Home.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ const meta: Meta<typeof HomeComponent> = {
export default meta

export const DefaultHomePage = () => {
return <HomeComponent membershipPricingData={[]} />
return (
<HomeComponent
membershipPricingData={[]}
lodgePricing={{
normal: 69,
moreExpensive: 420
}}
/>
)
}
13 changes: 7 additions & 6 deletions client/src/app/HomeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BenefitSection from "./sections/BenefitSection"
import LandingSection from "./sections/LandingSection"
import PricingSection from "./sections/PricingSection"
import { benefits } from "./sections/utils/Benefits"
import { pricingBannerMessages } from "./sections/utils/Pricing"
import { lodgeBookingPricingBannerMessages } from "./sections/utils/Pricing"

export type HomeProps = {
/**
Expand Down Expand Up @@ -51,11 +51,12 @@ const HomeComponent = ({
note={content?.pricing?.discount}
pricings={membershipPricingData}
bannerContent={{
headline: pricingBannerMessages.headline,
priceInformation: pricingBannerMessages.priceInformation(
lodgePricing.normal
),
disclaimer: pricingBannerMessages.priceInformation(
headline: lodgeBookingPricingBannerMessages.headline,
priceInformation:
lodgeBookingPricingBannerMessages.priceInformation(
lodgePricing.normal
),
disclaimer: lodgeBookingPricingBannerMessages.priceInformation(
lodgePricing.moreExpensive
)
}}
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/bookings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const BookingPage = async () => {
<>
<BookingInformationAndCreation
enableNetworkRequests
lodgePrices={lodgePrices}
lodgePricing={lodgePrices}
lodgeInfoProps={{
children: <RenderedContent />,
imageSrcs: processedImages
Expand Down
9 changes: 3 additions & 6 deletions client/src/app/sections/utils/Pricing.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Pricing } from "@/components/utils/types"

export const pricingNote =
"*We have a discounted membership price on offer until Sunday 17th March so lock in now for a year of awesome memories!"
import { MembershipPricing } from "@/components/utils/types"

/**
* An object containing messages for the pricing banner.
*/
export const pricingBannerMessages = {
export const lodgeBookingPricingBannerMessages = {
/**
* The headline message for the pricing banner.
*/
Expand All @@ -31,7 +28,7 @@ export const pricingBannerMessages = {
`*$${moreExpensivePrice} when booking a single Friday or Saturday` as const
} as const

export const Pricings: Pricing[] = [
export const MembershipPricings: MembershipPricing[] = [
{
title: "UoA Student",
discountedPrice: "$45",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ interface IBookingInformationAndCreation {
*/
enableNetworkRequests?: boolean

lodgePrices: LodgePricingProps
/**
* How much each the different types of bookings cost, based on {@link LodgePricingProps}
*/
lodgePricing: LodgePricingProps
}

/**
Expand All @@ -47,7 +50,7 @@ const BookingInformationAndCreation = ({
bookingCreationProps,
lodgeInfoProps,
enableNetworkRequests,
lodgePrices
lodgePricing
}: IBookingInformationAndCreation) => {
const params = useSearchParams()

Expand All @@ -70,12 +73,12 @@ const BookingInformationAndCreation = ({
)
case "booking-creation":
if (enableNetworkRequests) {
return <ProtectedCreateBookingSection lodgePrices={lodgePrices} />
return <ProtectedCreateBookingSection lodgePrices={lodgePricing} />
} else {
return (
<CreateBookingSection
{...bookingCreationProps}
lodgePrices={lodgePrices}
lodgePrices={lodgePricing}
/>
)
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/utils/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type Benefit = {
/**
* For use with the pricing cards that have the `home` variant
*/
export type Pricing = {
export type MembershipPricing = {
title: string
originalPrice?: string
discountedPrice: string
Expand Down

0 comments on commit a355b38

Please sign in to comment.