-
Notifications
You must be signed in to change notification settings - Fork 576
/
Copy pathtemplate.jsx
56 lines (49 loc) · 1.29 KB
/
template.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* @flow */
/** @jsx node */
import { node, Style, type ChildType } from "@krakenjs/jsx-pragmatic/src";
import { getCSPNonce } from "@paypal/sdk-client/src";
import {
VenmoLogoExternalImage,
VenmoLogoInlineSVG,
} from "@paypal/sdk-logos/src";
import {
type WalletLabelOptions,
type LabelOptions,
BasicLabel,
} from "../common";
import { Text, Space } from "../../ui/text";
import css from "./style.scoped.scss";
export function Label(opts: LabelOptions): ChildType {
return <BasicLabel {...opts} />;
}
export function WalletLabel({ ...props }: WalletLabelOptions): ChildType {
const { instrument, logoColor } = props;
let label;
const logo = __WEB__ ? (
<VenmoLogoExternalImage logoColor={logoColor} />
) : (
<VenmoLogoInlineSVG logoColor={logoColor} />
);
if (instrument && instrument.label) {
label = instrument.label;
}
const cspNonce = getCSPNonce();
return (
<Style nonce={cspNonce} css={css}>
<div class="wallet-label-venmo">
<div class="divider">|</div>
{logo && (
<div class="logo" optional>
{logo}
<Space />
</div>
)}
{label && (
<div class="label">
<Text className={["limit"]}>{label}</Text>
</div>
)}
</div>
</Style>
);
}