-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
631 frontend connect the policy to sanity (#773)
* Added schemas and util files for each of the policies sub folders * Fixed codestyle issue * Implemented policies using sanity schema and utilised this on the tab content, which is displayed on the bookings page * Formatted file properly * Removed async from file as its not supported * ran yarn to pass precode checks * Removed unwanted changes * Fetched the policies blocks, stored the values and called this in layout to be displayed above the footer * Added title and order to policies schema and util so that it can be sorted by either the title or order * Fixed the bug now the headings match with the content, nothing is out of bounds * Fixed TabContent.story and ran yarn-dev-server * removed line in packag.json server * deleted package-lock.json file * restore yarn.lock to master version * Adjusted layout.tsx to remove type error * Fixed issue in TabsComponent.story.tsx and reset default export on layoout.tsx * Fixed duplicate imports issue * fix errors --------- Co-authored-by: bcho892 <[email protected]>
- Loading branch information
1 parent
28bf167
commit e79e199
Showing
11 changed files
with
249 additions
and
485 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client" | ||
|
||
import { | ||
BookingContext, | ||
PolicyWithTextBlocks | ||
} from "@/components/composite/Booking/BookingContext" | ||
import { useContext, useEffect } from "react" | ||
|
||
const BookingPolicyStorage = ({ | ||
policies | ||
}: { | ||
policies: PolicyWithTextBlocks[] | ||
}) => { | ||
const { setPolicies } = useContext(BookingContext) | ||
useEffect(() => { | ||
setPolicies?.(policies) | ||
}, [policies, setPolicies]) | ||
|
||
return null | ||
} | ||
|
||
export default BookingPolicyStorage |
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
96 changes: 78 additions & 18 deletions
96
client/src/components/composite/BookingsPolicyTabs/TabsContent.story.tsx
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,27 +1,87 @@ | ||
import type { Meta } from "@storybook/react" | ||
import { | ||
BehaviourPolicyContent, | ||
BookingPolicyContent, | ||
PolicyTabs | ||
} from "./TabsContent" | ||
import { PolicyTabs } from "./TabsContent" | ||
import { PortableText } from "next-sanity" | ||
|
||
const meta: Meta = { | ||
component: PolicyTabs | ||
} | ||
|
||
const PoliciesContent = [ | ||
{ | ||
order: 0, | ||
title: "LODGE BOOKINGS", | ||
information: ( | ||
<PortableText | ||
value={[ | ||
{ | ||
_key: "1", | ||
_type: "block", | ||
children: [ | ||
{ | ||
_key: "2", | ||
_type: "span", | ||
marks: [], | ||
text: "This is the lodge bookings policy" | ||
} | ||
], | ||
markDefs: [], | ||
style: "normal" | ||
} | ||
]} | ||
/> | ||
) | ||
}, | ||
{ | ||
order: 1, | ||
title: "CANCELLATION", | ||
information: ( | ||
<PortableText | ||
value={[ | ||
{ | ||
_key: "3", | ||
_type: "block", | ||
children: [ | ||
{ | ||
_key: "4", | ||
_type: "span", | ||
marks: [], | ||
text: "This is the cancellation policy" | ||
} | ||
], | ||
markDefs: [], | ||
style: "normal" | ||
} | ||
]} | ||
/> | ||
) | ||
}, | ||
{ | ||
order: 2, | ||
title: "BEHAVIOUR", | ||
information: ( | ||
<PortableText | ||
value={[ | ||
{ | ||
_key: "5", | ||
_type: "block", | ||
children: [ | ||
{ | ||
_key: "6", | ||
_type: "span", | ||
marks: [], | ||
text: "This is the behaviour policy" | ||
} | ||
], | ||
markDefs: [], | ||
style: "normal" | ||
} | ||
]} | ||
/> | ||
) | ||
} | ||
] | ||
|
||
export default meta | ||
export const DefaultPolicyTabs = () => { | ||
return <PolicyTabs /> | ||
} | ||
|
||
export const BookingPolicyStory = () => { | ||
return <BookingPolicyContent /> | ||
} | ||
|
||
export const CancellationPolicyStory = () => { | ||
return <CancellationPolicyStory /> | ||
} | ||
|
||
export const BehaviourPolicyStory = () => { | ||
return <BehaviourPolicyContent /> | ||
return <PolicyTabs policiesArray={PoliciesContent} /> | ||
} |
Oops, something went wrong.