-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathcta-button.tsx
40 lines (36 loc) · 1.07 KB
/
cta-button.tsx
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
import React, { ComponentProps, FC, RefObject } from 'react'
import classnames from 'classnames'
import { withForwardRef } from '../common/component-utils/forwardRef'
import { EbayIcon } from '../ebay-icon'
import { EbayButtonCell, Size } from '../ebay-button'
type HTMLAnchorProps = ComponentProps<'a'>;
type Props = HTMLAnchorProps & {
fluid?: boolean;
truncate?: boolean;
size?: Size;
forwardedRef?: RefObject<HTMLAnchorElement>;
}
const EbayCtaButton: FC<Props> = ({
size,
children,
fluid,
truncate,
forwardedRef,
className: extraClasses,
...rest
}) => {
const className = classnames(extraClasses, 'cta-btn',
{ 'cta-btn--large': size === 'large' },
{ 'cta-btn--fluid': fluid },
{ 'cta-btn--truncated': truncate }
)
return (
<a {...rest} className={className} ref={forwardedRef}>
<EbayButtonCell type="cta">
<span>{children}</span>
<EbayIcon name="arrowRight24" />
</EbayButtonCell>
</a>
)
}
export default withForwardRef(EbayCtaButton)