Skip to content

Commit e83d96d

Browse files
committed
New landingpage for v1.0.0
1 parent 3c3f41d commit e83d96d

32 files changed

+9601
-1326
lines changed
File renamed without changes.

landingpage/src/.babelrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"env": {
3+
"production": {
4+
"plugins": ["transform-remove-console"]
5+
}
6+
}
7+
}

landingpage/src/.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.php]
14+
indent_size = 4
15+
16+
[resources/views/**.php]
17+
indent_size = 2

landingpage/src/.eslintrc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"extends": "airbnb-base",
3+
"parser": "babel-eslint",
4+
"env": {
5+
"jest": true
6+
},
7+
"rules": {
8+
"no-console": 0,
9+
"quotes": ["error", "single"],
10+
"comma-dangle": [
11+
"error",
12+
{
13+
"arrays": "always-multiline",
14+
"objects": "always-multiline",
15+
"imports": "always-multiline",
16+
"exports": "always-multiline",
17+
"functions": "ignore"
18+
}
19+
],
20+
"no-underscore-dangle": ["error", { "allow": ["_id"] }]
21+
},
22+
"globals": {
23+
"fetch": false,
24+
"browser": true,
25+
"window": true,
26+
"document": true,
27+
"Image": true
28+
}
29+
}

landingpage/src/index.html

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<html>
2+
<meta http-equiv="x-ua-compatible" content="ie=edge">
3+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1">
4+
<title>Conversational Form – Turn your content into conversations – by SPACE10</title>
5+
<meta property="og:title" content="Conversational Form – Turn your content into conversations – by SPACE10">
6+
<meta property="og:site_name" content="Conversational Form">
7+
<meta property="og:url" content="https://space10-community.github.io/conversational-form/landingpage/">
8+
<meta property="og:description" content="Conversational Form is an open-source tool from SPACE10 that enables people to turn your content into conversations.">
9+
<meta property="og:type" content="website">
10+
<meta property="og:image" content="https://raw.githubusercontent.com/space10-community/conversational-form/master/docs/0.9.70/assets/readme-cf.gif">
11+
12+
<!-- Global site tag (gtag.js) - Google Analytics -->
13+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-69941652-5"></script>
14+
<script>
15+
window.dataLayer = window.dataLayer || [];
16+
function gtag(){dataLayer.push(arguments);}
17+
gtag('js', new Date());
18+
19+
gtag('config', 'UA-69941652-5');
20+
</script>
21+
<body>
22+
<div class="wrapper">
23+
<header>
24+
<div>
25+
<a href="https://github.com/space10-community/conversational-form" target="_blank" class="btnRollUpAnim">
26+
<span>GitHub</span>
27+
<span>GitHub</span>
28+
</a>
29+
</div>
30+
<div>
31+
<a href="https://space10-community.github.io/conversational-form/docs/0.9.90/getting-started/" target="_blank" class="btnRollUpAnim">
32+
<span>Documentation</span>
33+
<span>Documentation</span>
34+
</a>
35+
</div>
36+
<div>
37+
<a href="https://space10.io/project/conversational-form/" target="_blank" class="btnRollUpAnim">
38+
<span>About</span>
39+
<span>About</span>
40+
</a>
41+
</div>
42+
</header>
43+
<main>
44+
<h1><span>Turn your</span><br />
45+
<div class="content">
46+
<div class="content__container">
47+
<ul class="content__container__list">
48+
<li class="content__container__list__item">content</li>
49+
<li class="content__container__list__item">surveys</li>
50+
<li class="content__container__list__item">sales</li>
51+
<li class="content__container__list__item">research</li>
52+
</ul>
53+
</div>
54+
</div>
55+
<span>into conversations</span>
56+
</h1>
57+
<form action="" class="form">
58+
<input cf-questions="Conversational Form is an open-source concept from SPACE10.&&It can turn any form element on a web page into a beautiful conversational experience.&&Would you like to learn more?" cf-label="Yes" type="radio" name="getstarted" tabindex="1" value="yes">
59+
<input cf-label="No" type="radio" name="getstarted" tabindex="2" value="no">
60+
61+
<fieldset cf-questions="You can also add images as responses!">
62+
<input cf-conditional-getstarted="yes" cf-label="Future Food" type="radio" cf-image="./photo1.jpg" name="imageAnswer" tabindex="1" value="0">
63+
<input cf-conditional-getstarted="yes" cf-label="SolarVille" type="radio" cf-image="./photo2.jpg" name="imageAnswer" tabindex="2" value="1">
64+
<input cf-conditional-getstarted="yes" cf-label="Urban Village" type="radio" cf-image="./photo3.jpg" name="imageAnswer" tabindex="3" value="2">
65+
</fieldset>
66+
67+
<cf-robot-message cf-conditional-getstarted="no" cf-questions="Understood.&&If you get curious regardless, check out the documentation to start making your own conversational experiences today."></cf-robot-message>
68+
69+
<fieldset cf-conditional-getstarted="yes" cf-questions="Nice! We've added some new features in V1.0 like smoother animations and some prebuilt themes.">
70+
<input cf-conditional-getstarted="yes" cf-label="Dark" type="radio" name="theme" tabindex="1" value="conversational-form-dark.min.css" checked>
71+
<input cf-conditional-getstarted="yes" cf-label="Light" type="radio" name="theme" tabindex="1" value="conversational-form.min.css">
72+
<input cf-conditional-getstarted="yes" cf-label="Green" type="radio" name="theme" tabindex="1" value="conversational-form-green.min.css">
73+
<input cf-conditional-getstarted="yes" cf-label="Purple" type="radio" name="theme" tabindex="1" value="conversational-form-purple.min.css">
74+
<input cf-conditional-getstarted="yes" cf-label="Blue" type="radio" name="theme" tabindex="1" value="conversational-form-irisblue.min.css">
75+
<input cf-conditional-getstarted="yes" cf-label="Red" type="radio" name="theme" tabindex="1" value="conversational-form-red.min.css">
76+
</fieldset>
77+
78+
<fieldset cf-conditional-getstarted="yes" cf-questions="Awesome. You can click the previous answer to change the theme again.">
79+
<input cf-conditional-getstarted="yes" type="radio" cf-label="Let me try that." name="changeThemeAgain" value="yes">
80+
<input cf-conditional-getstarted="yes" type="radio" cf-label="I'm good." name="changeThemeAgain" value="no">
81+
</fieldset>
82+
</form>
83+
<div class="cf"></div>
84+
85+
<div class="row">
86+
<div class="about">
87+
<p>Conversational Form is an open-source tool from <a href="https://space10.io"><strong>SPACE10</strong></a> that enables people to turn information into conversations—be it report insights, application flows or something completely different altogether. Try Conversational Form to jumpstart a conversation and make your content more engaging today.</p>
88+
<p>
89+
<a href="https://space10-community.github.io/conversational-form/docs/1.0.0/getting-started/" target="_blank" class="button btnRollUpAnim">
90+
<span>Documentation</span>
91+
<span>Documentation</span>
92+
</a>
93+
</p>
94+
</div>
95+
</div>
96+
</main>
97+
<footer>
98+
<p>
99+
Copyright © 2019 <a href="https://space10.io" target="_blank">SPACE10</a>.<br />
100+
All rights reserved.
101+
</p>
102+
<p>
103+
V1.0<br />
104+
<a href="https://space10-community.github.io/conversational-form/" target="_blank">Github</a>
105+
</p>
106+
<p>
107+
Licensed under MIT<br />
108+
Documentation CC BY 3.0
109+
</p>
110+
</footer>
111+
</div>
112+
<script src="./main.js"></script>
113+
</body>
114+
</html>

landingpage/src/main.js

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
import { ConversationalForm } from 'conversational-form';
2+
import {
3+
TweenLite,
4+
} from 'gsap/TweenMax';
5+
// import { Power3 } from 'gsap/EasePack';
6+
import loadcss from 'loadcss';
7+
import Tracking from './tracking';
8+
import 'reset-css';
9+
import './scss/main.scss';
10+
11+
const animTime = 0.8;
12+
const themes = [
13+
'conversational-form-dark.min.css',
14+
'conversational-form.min.css',
15+
'conversational-form-purple.min.css',
16+
'conversational-form-irisblue.min.css',
17+
'conversational-form-red.min.css',
18+
'conversational-form-green.min.css',
19+
];
20+
let currentTheme = themes[0];
21+
22+
function preloadFormImages() {
23+
const images = [].slice.call(document.querySelectorAll('form *[cf-image]'));
24+
// eslint-disable-next-line no-return-assign
25+
images.map(el => (new Image()).src = el.getAttribute('cf-image'));
26+
}
27+
28+
function loadThemes() {
29+
console.log('loadThemes');
30+
31+
loadcss(themes.map(t => `./${t}`), (links) => {
32+
links.forEach(link => console.log(link));
33+
34+
const stylesheets = [].slice.call(document.styleSheets);
35+
stylesheets.map((s, i) => {
36+
// console.log(i, s);
37+
if (i > 1) document.styleSheets[i].disabled = true;
38+
return s;
39+
});
40+
});
41+
}
42+
43+
function changeTheme(themeName) {
44+
console.log(currentTheme);
45+
if (currentTheme === themeName) return;
46+
47+
console.log('changeTheme', themeName);
48+
const stylesheets = [].slice.call(document.styleSheets);
49+
stylesheets.map((s, i) => {
50+
if (i > 0 && document.styleSheets[i].disabled === false) {
51+
document.styleSheets[i].disabled = true;
52+
} else if (document.styleSheets[i].href.indexOf(themeName) > -1) {
53+
document.styleSheets[i].disabled = false;
54+
currentTheme = themeName;
55+
}
56+
console.log('theme', i, document.styleSheets[i].href, document.styleSheets[i].disabled);
57+
58+
return s;
59+
});
60+
}
61+
62+
window.changeTheme = changeTheme;
63+
64+
function animateIn() {
65+
console.log('animateIn');
66+
const headerEl = document.querySelector('header');
67+
const headlineEl = document.querySelector('h1');
68+
const cfEl = document.querySelector('.cf');
69+
const aboutEl = document.querySelector('.about');
70+
71+
if (
72+
window.innerHeight < 780
73+
) {
74+
TweenLite.set(
75+
headlineEl,
76+
{
77+
css: {
78+
scale: 0.68,
79+
'margin-top': 60,
80+
'margin-bottom': 60,
81+
},
82+
},
83+
);
84+
}
85+
86+
TweenLite.set(headerEl, { y: 10 });
87+
TweenLite.to(
88+
headerEl,
89+
animTime / 2,
90+
{
91+
opacity: 1,
92+
y: 0,
93+
},
94+
);
95+
96+
TweenLite.set(headlineEl, { y: 20 });
97+
TweenLite.to(
98+
headlineEl,
99+
animTime,
100+
{
101+
opacity: 1,
102+
y: 0,
103+
// onComplete: scaleDownHeader(headlineEl),
104+
delay: animTime / 2,
105+
},
106+
);
107+
108+
TweenLite.set(cfEl, { y: 40 });
109+
TweenLite.to(
110+
cfEl,
111+
animTime * 1.2,
112+
{
113+
opacity: 1,
114+
y: 0,
115+
delay: animTime,
116+
},
117+
);
118+
119+
setTimeout(
120+
() => {
121+
window.ConversationalForm.start();
122+
},
123+
animTime * 0.6 * 1000,
124+
);
125+
126+
TweenLite.to(
127+
aboutEl,
128+
animTime * 3,
129+
{
130+
opacity: 1,
131+
delay: animTime * 2,
132+
},
133+
);
134+
}
135+
136+
function init() {
137+
loadThemes();
138+
preloadFormImages();
139+
140+
Tracking.registerAllExternalLinks();
141+
142+
const wrapperEl = document.querySelector('.wrapper');
143+
const formEl = document.querySelector('.form');
144+
const cfEl = document.querySelector('.cf');
145+
146+
// eslint-disable-next-line no-unused-vars
147+
const cfInstance = new ConversationalForm({
148+
formEl,
149+
context: cfEl,
150+
loadExternalStyleSheet: false,
151+
preventAutoFocus: true,
152+
preventAutoStart: true,
153+
submitCallback: () => {
154+
const formDataSerialized = cfInstance.getFormData(true);
155+
console.log('done', formDataSerialized);
156+
if (
157+
formDataSerialized.getstarted
158+
&& formDataSerialized.getstarted.indexOf('no') === -1
159+
) {
160+
cfInstance.addRobotChatResponse('Ok. Thank you for trying out Conversational Form.');
161+
}
162+
},
163+
flowStepCallback: (dto, success) => {
164+
console.log('fsc', dto.tag.name, dto.tag.value);
165+
166+
Tracking.event('conversational form example', dto.tag.name, dto.tag.value);
167+
168+
if (dto.tag.name === 'theme') changeTheme(dto.tag.value[0]);
169+
170+
setTimeout(() => {
171+
if (
172+
dto.tag.name !== 'changeThemeAgain'
173+
|| (
174+
dto.tag.name === 'changeThemeAgain'
175+
&& dto.tag.value[0] !== 'yes'
176+
)
177+
) {
178+
success();
179+
}
180+
181+
if (
182+
dto.tag.name === 'changeThemeAgain'
183+
&& dto.tag.value[0] === 'yes'
184+
) {
185+
window.ConversationalForm.remapTagsAndStartFrom(3);
186+
}
187+
}, 0);
188+
},
189+
});
190+
191+
TweenLite.to(
192+
wrapperEl,
193+
1,
194+
{
195+
opacity: 1,
196+
// ease: Power1,
197+
delay: animTime / 2,
198+
onComplete: animateIn,
199+
},
200+
);
201+
}
202+
203+
document.addEventListener('DOMContentLoaded', init);

0 commit comments

Comments
 (0)