Skip to content

Commit fd3bfd6

Browse files
committed
using typescript, removing TOC
1 parent beba8f7 commit fd3bfd6

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

Diff for: src/components/LandingPageWrapper.js renamed to src/components/LandingPageWrapper.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import Head from '@docusaurus/Head';
2-
import React, { useLayoutEffect } from 'react';
2+
import React from 'react';
33
import useForm from '../hooks/useForm';
44
import useMunchkin from '../hooks/useMunchkin';
55
import useSqueeze from '../hooks/useSqueeze';
66

7-
export default function LandingPageWrapper({ thankYou, children }) {
7+
export interface LandingPageWrapperProps {
8+
thankYou: string;
9+
}
10+
11+
export default function LandingPageWrapper({
12+
thankYou,
13+
children,
14+
}: React.PropsWithChildren<LandingPageWrapperProps>) {
815
useSqueeze();
916
useForm(thankYou);
1017
useMunchkin();

Diff for: src/hooks/useForm.js renamed to src/hooks/useForm.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-misused-promises */
12
import { useLayoutEffect } from 'react';
23

3-
export default function useForm(thankYou) {
4+
declare const MktoForms2: any;
5+
6+
export default function useForm(thankYou: string) {
47
useLayoutEffect(() => {
58
const interval = setInterval(() => {
69
if (typeof MktoForms2 === 'undefined') {
@@ -11,7 +14,8 @@ export default function useForm(thankYou) {
1114
document.querySelectorAll('.m-form').forEach(async (el) => {
1215
const id = el.id.split('_')[1];
1316
MktoForms2.setOptions({
14-
formXDPath: 'https://lp.redis.com/rs/915-NFD-128/images/marketo-xdframe-relative.html',
17+
formXDPath:
18+
'https://lp.redis.com/rs/915-NFD-128/images/marketo-xdframe-relative.html',
1519
});
1620

1721
let prefills = {};
@@ -34,18 +38,17 @@ export default function useForm(thankYou) {
3438
'//lp.redis.com',
3539
'915-NFD-128',
3640
Number(id),
37-
(form) => {
41+
(form: any) => {
3842
if (Object.keys(prefills).length > 0) {
3943
form.vals(prefills);
4044
}
4145

4246
if (!thankYou) {
43-
return;
47+
return;
4448
}
4549

4650
form.onSuccess(() => {
47-
form.getFormElem().hide();
48-
51+
form.getFormElem().hide();
4952
});
5053
},
5154
);

Diff for: src/hooks/useMunchkin.js renamed to src/hooks/useMunchkin.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/ban-ts-comment */
12
import { useLayoutEffect } from 'react';
23

4+
declare const Munchkin: any;
5+
36
export default function useMunchkin() {
47
useLayoutEffect(() => {
5-
var didInit = false;
8+
let didInit = false;
69
function initMunchkin() {
710
if (didInit === false) {
811
didInit = true;
912
Munchkin.init('915-NFD-128');
1013
}
1114
}
12-
var s = document.createElement('script');
15+
const s = document.createElement('script');
1316
s.type = 'text/javascript';
1417
s.async = true;
1518
s.src = '//munchkin.marketo.net/munchkin.js';
19+
// @ts-ignore
1620
s.onreadystatechange = function () {
21+
// @ts-ignore
1722
if (this.readyState == 'complete' || this.readyState == 'loaded') {
1823
initMunchkin();
1924
}
File renamed without changes.

Diff for: src/pages/lp/learn-to-earn-jwt.js renamed to src/pages/lp/learn-to-earn-jwt.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useLayoutEffect } from 'react';
1+
import React from 'react';
22
import Layout from '@theme/Layout';
33
import LandingPageWrapper from '../../components/LandingPageWrapper';
44

@@ -17,7 +17,7 @@ export default function LearnToEarnJWT() {
1717
style={{
1818
width: '70%',
1919
minWidth: '370px',
20-
margin: 'auto'
20+
margin: 'auto',
2121
}}>
2222
<p>
2323
Complete this short assessment for a chance to earn a $25 Amazon

Diff for: src/theme/Launchpad/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function Launchpad() {
1414
target="_blank"
1515
rel="noopener"
1616
className="link">
17-
1817
<img
1918
src="/img/launchpad.png"
2019
className="thumb"
-84 KB
Binary file not shown.

0 commit comments

Comments
 (0)