Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/aimba/registration/Registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {PromoCountdown} from './PromoCountdown';
import {RegistrationForm} from './RegistrationForm';

export let Registration = ({
setDialog,
onRegistrationFormSubmit,
contents: {
registration: {backgroundImage}
Expand Down Expand Up @@ -63,7 +64,7 @@ export let Registration = ({
<div class="description">Ưu đãi có hạn, đăng ký ngay để <com-word>không bỏ lỡ</com-word></div>
<PromoCountdown />
</div>
<RegistrationForm onSubmit={onRegistrationFormSubmit} />
<RegistrationForm onSubmit={onRegistrationFormSubmit} setDialog={setDialog} />
</div>
</div>
</section>
Expand Down
7 changes: 5 additions & 2 deletions src/aimba/registration/RegistrationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './RegistrationForm.less';
import {useState} from 'fiddlehead';
import {fbqEmit} from '../tracking';

export let RegistrationForm = ({onSubmit}) => {
export let RegistrationForm = ({onSubmit, setDialog}) => {
let [feedback, setFeedback] = useState(null);

let handleSubmit = (event) => {
Expand All @@ -14,10 +14,13 @@ export let RegistrationForm = ({onSubmit}) => {
setFeedback(feedback);
if (feedback.type === 'success') {
form.reset();
fbqEmit('track', 'Lead');
setTimeout(() => {
setDialog(null);
}, 2000);
}
};
onSubmit({formData, onFeedback});
fbqEmit('track', 'Lead');
};

let handleChange = () => {
Expand Down
19 changes: 6 additions & 13 deletions src/aimba/slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ export let Slider = ({
infinite = false,
children = renderContent
}) => {
let buffer = 2;
let slideAreas = infinite ? ['head', 'body', 'tail'] : ['body'];

let scrollViewRef = useRef(null);
let scrollingEndDebounceRef = useRef(null);
let [scrollable, setScrollable] = useState(false);
let [scrolling, setScrolling] = useState(false);
let [paused, setPaused] = useState(false);
let [slideStates, setSlideStates] = useState(() => {
let states = {};
for (let area of slideAreas) {
Expand All @@ -25,18 +30,6 @@ export let Slider = ({
return states;
});

let scrollViewRef = useRef(null);

let [scrollable, setScrollable] = useState(false);

let [scrolling, setScrolling] = useState(false);

let [paused, setPaused] = useState(false);

let scrollingEndDebounceRef = useRef(null);

let buffer = 2;

let getSlideMargin = () => {
let scrollView = scrollViewRef.current;
if (scrollView == null) {
Expand Down
Loading