Skip to content
Open
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
1 change: 1 addition & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
38 changes: 36 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"moment": "^2.29.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
Expand Down
30 changes: 30 additions & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import { useCallback, useEffect, useState } from "react";
import axios from "axios";
import CurrentTime from "./currentTime";
import { isPalindrome } from "./isPalindrome.js";

axios.defaults.baseURL = 'http://localhost:5000';
axios.defaults.headers.post['Content-Type'] = 'applicatin/json';

// const btn = document.getElementById("btn");
// if (btn.addEventListener === true) {
// alert("yes is a palindrome");
// } else {
// alert("not a palindrome");
// }

// btn.addEventListener("click", isPalindrome, false);
// if(isPalindrome() === true){
// alert("is a palindorme")

// } else {
// alert("not a palindrome")
// }

const Inbox = () => {
return <div>
<input type="text" onKeyDown={() => isPalindrome()}></input>
<span>is a palindrome</span>
<input id="btn" type="submit" value="add" ></input>
</div>

}

function App() {
const [palindromeList, setPalindromList] = useState([]);

Expand Down Expand Up @@ -33,6 +59,10 @@ function App() {
<p>
This is the bootcamp final.
</p>
<div>
<CurrentTime></CurrentTime>
<Inbox></Inbox>
</div>
{
<ul>
{
Expand Down
22 changes: 22 additions & 0 deletions client/src/currentTime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { useState, useEffect } from 'react';

export const CurrentTime = () => {
var [date, setDate] = useState(new Date());


useEffect(() => {
var timer = setInterval(()=>setDate(new Date()), 1000 )
return function cleanup() {
clearInterval(timer)
}

});

return(
<div>
<p> {date.toLocaleDateString()} {date.toLocaleTimeString()}</p>
</div>
)
}

export default CurrentTime;
12 changes: 12 additions & 0 deletions client/src/isPalindrome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function isPalindrome(str = " ") {
var word = str.length;
if (word === 1){
console.log(true) && alert("1 word is a palindrome");
}
else if (str[0] === str[word - 1]) {
return isPalindrome(str.slice(1, word - 1)) && alert("is a palindrome");
} else{
console.log(false) && alert("not a palindrome");
}
}

Loading