File tree 3 files changed +6
-5
lines changed
3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import unionpay from './unionpay.js';
7
7
import mastercard from './mastercard.js' ;
8
8
import placeholder from './placeholder.js' ;
9
9
import visa from './visa.js' ;
10
+ import { CardType } from '../utils/validation.js' ;
10
11
11
12
export default {
12
13
amex,
@@ -18,4 +19,4 @@ export default {
18
19
mastercard,
19
20
placeholder,
20
21
visa,
21
- } ;
22
+ } as { [ key in CardType ] : React . ReactNode | JSX . Element } ;
Original file line number Diff line number Diff line change @@ -5,19 +5,19 @@ interface UseCardBrandProps {
5
5
images ?: {
6
6
[ key : string ] : React . ReactNode | JSX . Element ;
7
7
} ;
8
- cardNumber ?: string ;
8
+ type ?: string ;
9
9
ariaLabel ?: string ;
10
10
}
11
11
12
12
export default function useCardBrand ( ) {
13
13
const getSvgProps = React . useCallback ( ( props : UseCardBrandProps = { } ) => {
14
14
const images = props . images ?? { } ;
15
- const type = 'placeholder' ;
15
+ const type = props . type ?? 'placeholder' ;
16
16
17
17
return React . useMemo (
18
18
( ) => ( {
19
19
'aria-label' : props . ariaLabel ?? 'Placeholder card' ,
20
- children : images [ type ] || images ,
20
+ children : images [ type ] || null ,
21
21
width : '1.5em' ,
22
22
height : '1em' ,
23
23
viewBox : '0 0 24 16' ,
Original file line number Diff line number Diff line change 1
- enum CardType {
1
+ export enum CardType {
2
2
Amex = 'amex' ,
3
3
Diners = 'dinersclub' ,
4
4
Discover = 'discover' ,
You can’t perform that action at this time.
0 commit comments