File tree 2 files changed +61
-1
lines changed
2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
2
2
import scrollToElement from 'scroll-to-element' ;
3
3
import Input from './Input.jsx' ;
4
4
import Output from './Output/Output.jsx' ;
5
+ import FloatingCta from './FloatingCta.jsx' ;
5
6
import { analyzeWithAllFeatures } from './utils/request' ;
6
7
7
8
// eslint-disable-next-line
@@ -55,7 +56,12 @@ export default React.createClass({
55
56
} = this . state ;
56
57
57
58
return (
58
- < div className = "_container _container_large" >
59
+ < div className = "demo _container _container_large" >
60
+ < FloatingCta
61
+ link = "https://cloud.ibm.com/registration/?target=%2Fcatalog%2Fservices%2Fnatural-language-understanding%3FhideTours%3Dtrue%26cm_mmc%3D-_-Watson%2BCore_Watson%2BCore%2B-%2BPlatform-_-WW_WW-_-wdc-ref%26cm_mmc%3D-_-Watson%2BCore_Watson%2BCore%2B-%2BPlatform-_-WW_WW-_-wdc-ref%26cm_mmca1%3D000000OF%26cm_mmca2%3D10000409"
62
+ label = "Start for free in IBM Cloud"
63
+ isVisible = { ( data !== null ) }
64
+ />
59
65
< Input
60
66
text = { DEFAULT_TEXT }
61
67
url = { DEFAULT_URL }
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+ import { StyleSheet , css } from 'aphrodite/no-important' ;
4
+
5
+ const styles = StyleSheet . create ( {
6
+ container : {
7
+ position : 'fixed' ,
8
+ bottom : '2rem' ,
9
+ right : '2rem' ,
10
+ paddingRight : '3em' ,
11
+ paddingLeft : '3em' ,
12
+ paddingTop : '0.2em' ,
13
+ paddingBottom : '0.2em' ,
14
+ backgroundColor : '#9855d4' ,
15
+ borderColor : '#9855d4' ,
16
+ borderRadius : '45px' ,
17
+ zIndex : 9999 ,
18
+ } ,
19
+ hidden : {
20
+ display : 'none' ,
21
+ opacity : 0 ,
22
+ } ,
23
+ visible : {
24
+ display : 'block' ,
25
+ opacity : 1 ,
26
+ } ,
27
+ label : {
28
+ color : '#FFFFFF' ,
29
+ } ,
30
+ } ) ;
31
+
32
+ const FloatingCta = ( {
33
+ link,
34
+ label,
35
+ isVisible,
36
+ } ) => {
37
+ const combinedVisibleStyles = ( isVisible )
38
+ ? css ( styles . container , styles . visible )
39
+ : css ( styles . container , styles . hidden ) ;
40
+
41
+ return (
42
+ < a className = { combinedVisibleStyles } href = { link } rel = "noreferrer noopener" target = "_blank" >
43
+ < p className = { css ( styles . label ) } > { label } </ p >
44
+ </ a >
45
+ ) ;
46
+ } ;
47
+
48
+ FloatingCta . propTypes = {
49
+ isVisible : PropTypes . bool . isRequired ,
50
+ link : PropTypes . string . isRequired ,
51
+ label : PropTypes . string . isRequired ,
52
+ } ;
53
+
54
+ export default FloatingCta ;
You can’t perform that action at this time.
0 commit comments