Skip to content

Commit

Permalink
docs: Storybook + jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Dec 13, 2024
1 parent 5fb30bf commit a868b07
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions editor.planx.uk/src/@planx/components/Pay/Public/Confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const PayText = styled(Box)(({ theme }) => ({
},
}));

/**
* Displayed when component is in an error state
* Relies on props.error being set
*/
const Error: React.FC<Props> = ({ onConfirm, error }) => {
if (error?.startsWith(PAY_API_ERROR_UNSUPPORTED_TEAM)) {
return (
Expand All @@ -79,6 +83,10 @@ const Error: React.FC<Props> = ({ onConfirm, error }) => {
);
};

/**
* Main functionality
* Allows users to make a payment via GovUK Pay
*/
const PayBody: React.FC<PayBodyProps> = (props) => {
const defaults = getDefaultContent();

Expand Down Expand Up @@ -117,6 +125,10 @@ const PayBody: React.FC<PayBodyProps> = (props) => {
);
};

/**
* Display information only - does not allow users to pay
* Generally used at the end of guidance services as an illustrative example of what you could pay
*/
const InformationOnly: React.FC<Props> = (props) => {
const defaults = getDefaultContent();

Expand All @@ -143,6 +155,10 @@ const InformationOnly: React.FC<Props> = (props) => {
);
};

/**
* Displayed if the fee is calculated as £0
* Still displays component and fee breakdown, but allows user to continue without making a payment
*/
const ZeroFee: React.FC<Props> = (props) => (
<Button
variant="contained"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@ export const WithFeeBreakdown = {
showInviteToPay: false,
},
} satisfies Story;

export const WithError = {
args: {
error: "GOV.UK Pay is not enabled for this local authority",
fee: 103,
onConfirm: () => {},
},
} satisfies Story;

0 comments on commit a868b07

Please sign in to comment.