forked from auth0/styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
60 lines (56 loc) · 1.5 KB
/
Copy pathindex.js
File metadata and controls
60 lines (56 loc) · 1.5 KB
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
57
58
59
60
/* eslint max-len: ["error", 100, { "ignoreComments": true }] */
import React, { PropTypes } from 'react';
/**
* Try Banner: The main call to action to signup.
*/
function TryBanner({ title, button, buttonAction, dark, className, ...rest }) {
return (
<div
className={`a0r-try-banner ${className} ${dark ? 'a0r-try-banner--dark' : ''}`}
{...rest}
>
<span className="a0r-try-banner__title">{title}</span>
{toString.call(buttonAction) === '[object String]' ?
<a
className="a0r-try-banner__button btn btn-success btn-lg"
href={buttonAction}
>{button}</a>
:
<button
className="a0r-try-banner__button btn btn-success btn-lg"
onClick={buttonAction}
>{button}</button>
}
</div>
);
}
TryBanner.propTypes = {
/**
* Try Banner title.
*/
title: PropTypes.string,
/**
* Text for the button.
*/
button: PropTypes.string,
/**
* Action of the button when pressed, this can be a URL (the button will be an anchor tag) or a function (the button will be a button tag).
*/
buttonAction: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
/**
* Display in dark mode if true.
*/
dark: PropTypes.bool,
/**
* Add CSS class selectors to the root element.
*/
className: PropTypes.string
};
TryBanner.defaultProps = {
title: 'Don\'t have an account yet?',
button: 'Try Auth0 for Free',
buttonAction: '#',
dark: false,
className: ''
};
export default TryBanner;