Skip to content

Commit

Permalink
Merge pull request #6 from arikchakma/Dev
Browse files Browse the repository at this point in the history
Transferred Newsletter JSX -> TSX
  • Loading branch information
arikchakma authored Mar 3, 2022
2 parents c0ac78e + 0100f32 commit 88bde98
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 77 deletions.
26 changes: 19 additions & 7 deletions components/Newsletter.js → components/Newsletter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import cn from 'classnames';
import SuccessMessage from './SuccessMessage';
import ErrorMessage from './ErrorMessage';

const canvasStyles = {
const canvasStyles: CSSProperties = {
position: 'fixed',
pointerEvents: 'none',
width: '100%',
Expand All @@ -14,17 +14,29 @@ const canvasStyles = {
left: 0
};

export default function Newsletter({ blog }) {
const [formState, setFormState] = useState({
type NewsletterProps = {
blog: boolean;
};

type NewsletterState = {
loading: boolean;
message: string;
success: boolean;
state: boolean;
};

export default function Newsletter({ blog }: NewsletterProps) {
const [formState, setFormState] = useState<NewsletterState>({
loading: false,
message: '',
success: false,
state: false
});
const [email, setEmail] = useState('');
const inputEl = useRef();

const refAnimationInstance = useRef(null);
const [email, setEmail] = useState<string>('');
const inputEl = useRef<HTMLInputElement>(null!);

const refAnimationInstance: React.MutableRefObject<any> = useRef(null);

const getInstance = useCallback(instance => {
refAnimationInstance.current = instance;
Expand Down Expand Up @@ -68,7 +80,7 @@ export default function Newsletter({ blog }) {
});
}, [makeShot]);

const subscribe = async e => {
const subscribe = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

setFormState(e => {
Expand Down
63 changes: 0 additions & 63 deletions components/RealisticFireWorks.js

This file was deleted.

6 changes: 0 additions & 6 deletions lib/supabase.js

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "components/Newsletter.js", "components/RealisticFireWorks.js"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "components/Newsletter.tsx", "components/RealisticFireWorks.tsx"],
"exclude": ["node_modules"]
}

1 comment on commit 88bde98

@vercel
Copy link

@vercel vercel bot commented on 88bde98 Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.