Ver código fonte

partialy completed techinical interview

develop
Ajay_S 3 anos atrás
pai
commit
c6e052ab2f
5 arquivos alterados com 47 adições e 12 exclusões
  1. +18
    -0
      package-lock.json
  2. +1
    -0
      package.json
  3. +1
    -1
      src/components/timeSlot/TimeSlot.module.scss
  4. +18
    -9
      src/components/timeSlot/TimeSlot.tsx
  5. +9
    -2
      src/pages/technicalInterview/TechnicalInterview.tsx

+ 18
- 0
package-lock.json Ver arquivo

@@ -24,6 +24,7 @@
"@types/react-dom": "^16.9.10", "@types/react-dom": "^16.9.10",
"@types/react-router": "^5.1.11", "@types/react-router": "^5.1.11",
"@types/react-router-dom": "^5.1.7", "@types/react-router-dom": "^5.1.7",
"date-fns": "^2.28.0",
"ionicons": "^5.4.0", "ionicons": "^5.4.0",
"node": "^17.7.2", "node": "^17.7.2",
"node-sass": "^7.0.1", "node-sass": "^7.0.1",
@@ -6225,6 +6226,18 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/date-fns": {
"version": "2.28.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz",
"integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==",
"engines": {
"node": ">=0.11"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/date-fns"
}
},
"node_modules/debug": { "node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -21168,6 +21181,11 @@
"whatwg-url": "^8.0.0" "whatwg-url": "^8.0.0"
} }
}, },
"date-fns": {
"version": "2.28.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz",
"integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw=="
},
"debug": { "debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",


+ 1
- 0
package.json Ver arquivo

@@ -19,6 +19,7 @@
"@types/react-dom": "^16.9.10", "@types/react-dom": "^16.9.10",
"@types/react-router": "^5.1.11", "@types/react-router": "^5.1.11",
"@types/react-router-dom": "^5.1.7", "@types/react-router-dom": "^5.1.7",
"date-fns": "^2.28.0",
"ionicons": "^5.4.0", "ionicons": "^5.4.0",
"node": "^17.7.2", "node": "^17.7.2",
"node-sass": "^7.0.1", "node-sass": "^7.0.1",


+ 1
- 1
src/components/timeSlot/TimeSlot.module.scss Ver arquivo

@@ -78,7 +78,7 @@
text-decoration: none; text-decoration: none;


ion-button { ion-button {
width: 90%;
width: 90%;
margin: 0 auto; margin: 0 auto;
margin-top: 18vh; margin-top: 18vh;
margin-bottom: 0; margin-bottom: 0;


+ 18
- 9
src/components/timeSlot/TimeSlot.tsx Ver arquivo

@@ -3,16 +3,20 @@ import styles from "./TimeSlot.module.scss";
import { chevronBack, key } from 'ionicons/icons' import { chevronBack, key } from 'ionicons/icons'
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { useState } from "react"; import { useState } from "react";
import { addDays } from "date-fns";



interface dates { interface dates {
date: string; date: string;
day: string; day: string;
} }



interface OwnProps { interface OwnProps {
month: string; month: string;
dates: dates[]; dates: dates[];
timeSlots: string[]; timeSlots: string[];
getDate: (date: string) => void;
} }


const TimeSlot: React.FC<OwnProps> = (props) => { const TimeSlot: React.FC<OwnProps> = (props) => {
@@ -20,7 +24,16 @@ const TimeSlot: React.FC<OwnProps> = (props) => {
const [highlightedDate, setHighlightedDate] = useState<dates>(); const [highlightedDate, setHighlightedDate] = useState<dates>();
const [highlightedTime, setHighlightedTime] = useState<string>(""); const [highlightedTime, setHighlightedTime] = useState<string>("");


const daysMap = new Map([[0, "Sun"], [1, "Mon"], [2, "Tue"], [3, "Wed"], [4, "Thu"], [5, "Fri"], [6, "Sat"]]);

const dates = props.dates.map((date, key) => { const dates = props.dates.map((date, key) => {
const currentDate = new Date();
let day = addDays(currentDate, key + 1)
// if (daysMap.get(day) === "Thu") { // sat
// day = addDays(currentDate, key + 3).getDay();
// } else if (daysMap.get(day) === "Fri") {
// day = addDays(currentDate, key + 3).getDay();
// }
return ( return (
<div <div
className={styles.date + " " + (date === highlightedDate ? styles.active : "")} className={styles.date + " " + (date === highlightedDate ? styles.active : "")}
@@ -28,10 +41,10 @@ const TimeSlot: React.FC<OwnProps> = (props) => {
onClick={() => setHighlightedDate(date)}> onClick={() => setHighlightedDate(date)}>


<div className={styles.day}> <div className={styles.day}>
{date.day}
{daysMap.get(day.getDay())}
</div> </div>
<div> <div>
{date.date}
{day.getDate()}
</div> </div>


</div> </div>
@@ -49,10 +62,6 @@ const TimeSlot: React.FC<OwnProps> = (props) => {
); );
}); });


if (highlightedDate && highlightedTime !== "") {

}

return ( return (
<IonPage> <IonPage>
<header className={styles.header}> <header className={styles.header}>
@@ -73,10 +82,10 @@ const TimeSlot: React.FC<OwnProps> = (props) => {
{timeSlots} {timeSlots}
</div> </div>


<Link to="/"
<div onClick={(highlightedDate && highlightedTime !== "") ? () => props.getDate("test") : undefined}
className={styles.timeSlotButton + " " + (highlightedDate && highlightedTime !== "" ? styles.buttonActive : "")}> className={styles.timeSlotButton + " " + (highlightedDate && highlightedTime !== "" ? styles.buttonActive : "")}>
<IonButton shape="round" expand='block'>Confirm slot</IonButton>
</Link>
<IonButton shape="round" expand='block' >Confirm slot</IonButton>
</div>
</IonContent> </IonContent>


</IonPage> </IonPage>


+ 9
- 2
src/pages/technicalInterview/TechnicalInterview.tsx Ver arquivo

@@ -37,7 +37,13 @@ const TechnicalInterview: React.FC = () => {
date: "03", date: "03",
day: "Wed" day: "Wed"
}, },
]
];

const getDate = (date: string) => {
console.log(date);
setTimeSlot(false);
setDate(true);
}


return ( return (
<IonPage> <IonPage>
@@ -94,7 +100,8 @@ const TechnicalInterview: React.FC = () => {
<TimeSlot <TimeSlot
month="April -May" month="April -May"
dates={dates} dates={dates}
timeSlots={timeSlots} />
timeSlots={timeSlots}
getDate={getDate} />
} }


</IonContent> </IonContent>


Carregando…
Cancelar
Salvar