Skip to content

Commit 08a629e

Browse files
converted majority codebase to typescript
1 parent deca667 commit 08a629e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+431
-311
lines changed

.eslintrc.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@
1515
"plugins": ["react", "@typescript-eslint"],
1616
"rules": {
1717
"react/prop-types": "off"
18-
}
18+
},
19+
"overrides": [
20+
{
21+
"files": ["*.ts", "*.tsx"],
22+
"rules": {
23+
"no-undef": "off"
24+
}
25+
}
26+
]
1927
}

components/AboutBlock.jsx components/AboutBlock.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import React from 'react'
22
import Image from 'next/image'
33

4-
export const AboutBlock = ({
4+
interface AboutBlockProps {
5+
title: string
6+
description: string
7+
linkTo: string
8+
linkTitle: string
9+
image: string
10+
reverse?: boolean
11+
}
12+
13+
export const AboutBlock: React.FC<AboutBlockProps> = ({
514
title,
615
description,
716
linkTo,

components/Button.js components/Button.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
import React from 'react'
2+
interface ButtonProps {
3+
children: React.ReactNode
4+
onClick: () => void
5+
primary?: boolean
6+
type?: 'button' | 'submit' | 'reset'
7+
customClass?: string
8+
}
29

3-
const Button = ({ children, primary, action, type, onClick, customClass }) => {
10+
const Button: React.FC<ButtonProps> = ({
11+
children,
12+
primary,
13+
type,
14+
onClick,
15+
customClass
16+
}) => {
417
const btnClass = primary ? 'btn-primary' : 'btn-default'
518
return (
619
<button
720
className={`btn ${btnClass} ${customClass}`}
8-
action={action}
921
type={type}
1022
onClick={onClick}
1123
>

components/CategorySelector.jsx components/CategorySelector.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import React, { useContext } from 'react'
22
import { AppContext } from '../utils/AppContext'
33

4-
export const CategorySelector = ({ disabled }) => {
4+
interface CategorySelectorProps {
5+
disabled: boolean
6+
}
7+
8+
export const CategorySelector: React.FC<CategorySelectorProps> = ({
9+
disabled
10+
}) => {
511
const { state, dispatch } = useContext(AppContext)
612

713
return (
@@ -19,7 +25,7 @@ export const CategorySelector = ({ disabled }) => {
1925
>
2026
<option value='all'>All</option>
2127

22-
{state.iconsCategoryList.map((ele, i) => {
28+
{state.iconsCategoryList.map((ele: string, i: number) => {
2329
return (
2430
<option key={i} value={ele}>
2531
{ele}

components/Code.js

-20
This file was deleted.

components/Contributor.js

-25
This file was deleted.

components/CookiesBanner.js components/CookiesBanner.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import Button from './Button'
55
import Cookies from 'js-cookie'
66

77
const CookiesBanner = () => {
8-
const [cookiesBanner, setCookiesBanner] = useState(false)
8+
const [cookiesBanner, setCookiesBanner] = useState<boolean>(false)
99

1010
/* Toggle customizable functionality */
11-
const cookiesHandler = (callback) => {
11+
const cookiesHandler = (callback: () => void) => {
1212
setCookiesBanner(true)
1313
return callback
1414
}

components/CustomizeIconsPanel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState, useContext } from 'react'
22
import Button from './Button'
33
import GeneratingFont from './GeneratingFont'
4-
import Modal from './Modal'
4+
import Modal from './Modal.tsx'
55
import ThankYou from './ThankYou'
66
import IconEditor from './IconEditor'
77
import axios from 'axios'
File renamed without changes.

components/Footer.js

-48
This file was deleted.

components/Footer.tsx

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import React from 'react'
2+
import links from '../utils/Links.store'
3+
import Image from 'next/image'
4+
import Link from 'next/link'
5+
6+
interface link {
7+
name: string
8+
href: string
9+
category: string
10+
action: string
11+
label: string
12+
target?: string
13+
}
14+
15+
interface FooterBlockProps {
16+
img?: any
17+
title: string
18+
links: link[]
19+
}
20+
21+
const Footer: React.FC = () => {
22+
return (
23+
links && (
24+
<footer>
25+
<div className='container flex flex-wrap'>
26+
<div className='container flex flex-wrap'>
27+
{links.map((ele, i) => {
28+
return <FooterBlock {...ele} key={i} />
29+
})}
30+
</div>
31+
<Link href={links[0].vercel!.href}>
32+
<a className='banner' target={links[0].vercel!.target}>
33+
<Image
34+
className=''
35+
src={links[0].vercel!.img}
36+
alt='vercel-banner'
37+
/>{' '}
38+
</a>
39+
</Link>
40+
</div>
41+
</footer>
42+
)
43+
)
44+
}
45+
46+
const FooterBlock: React.FC<FooterBlockProps> = ({ img, title, links }) => {
47+
return (
48+
<div className='footer-block'>
49+
<span>{img ? <Image src={img} alt='EOS Logo footer' /> : title}</span>
50+
<div className='footer-block-list'>
51+
{links?.map((ele, index) => (
52+
<a
53+
key={index}
54+
href={ele.href}
55+
data-types-category={ele.category}
56+
data-types-label={ele.label}
57+
data-types-action={ele.action}
58+
rel='noopener noreferrer'
59+
target={ele.target}
60+
>
61+
{ele.name}
62+
</a>
63+
))}
64+
</div>
65+
</div>
66+
)
67+
}
68+
69+
export default Footer

components/GeneratingFont.js components/GeneratingFont.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import loading from '../public/assets/images/loading.svg'
33
import Image from 'next/image'
44

5-
const GeneratingFont = (props) => {
5+
const GeneratingFont: React.FC = () => {
66
return (
77
<div className='icons-picker-loading'>
88
<div className='loading-icon'>

0 commit comments

Comments
 (0)