This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
624 additions
and
259 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
28 changes: 22 additions & 6 deletions
28
...tion/manage/NonEditableBillingAddress.tsx → ...nt/subscription/BillingAddressPreview.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
43 changes: 43 additions & 0 deletions
43
client/web/src/cody/management/subscription/PaymentMethodPreview.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
|
||
import { mdiPencilOutline, mdiCreditCardOutline, mdiPlus } from '@mdi/js' | ||
import classNames from 'classnames' | ||
|
||
import { H3, Button, Icon, Text } from '@sourcegraph/wildcard' | ||
|
||
import type { Subscription } from '../api/teamSubscriptions' | ||
|
||
import styles from './manage/PaymentDetails.module.scss' | ||
|
||
export const PaymentMethodPreview: React.FC< | ||
Pick<Subscription, 'paymentMethod'> & { isEditable: boolean; onButtonClick?: () => void; className?: string } | ||
> = ({ paymentMethod, isEditable, onButtonClick = () => undefined, className }) => | ||
paymentMethod ? ( | ||
<div className={className}> | ||
<div className="d-flex align-items-center justify-content-between"> | ||
<H3>Active credit card</H3> | ||
{isEditable && ( | ||
<Button variant="link" className={styles.titleButton} onClick={onButtonClick}> | ||
<Icon aria-hidden={true} svgPath={mdiPencilOutline} className="mr-1" /> Edit | ||
</Button> | ||
)} | ||
</div> | ||
<div className="mt-3 d-flex justify-content-between"> | ||
<Text as="span" className={classNames('text-muted', styles.paymentMethodNumber)}> | ||
<Icon aria-hidden={true} svgPath={mdiCreditCardOutline} /> ···· ···· ···· {paymentMethod.last4} | ||
</Text> | ||
<Text as="span" className="text-muted"> | ||
Expires {paymentMethod.expMonth}/{paymentMethod.expYear} | ||
</Text> | ||
</div> | ||
</div> | ||
) : ( | ||
<div className={classNames('d-flex align-items-center justify-content-between', className)}> | ||
<H3>No payment method is available</H3> | ||
{isEditable && ( | ||
<Button variant="link" className={styles.titleButton} onClick={onButtonClick}> | ||
<Icon aria-hidden={true} svgPath={mdiPlus} className="mr-1" /> Add | ||
</Button> | ||
)} | ||
</div> | ||
) |
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
Oops, something went wrong.