Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: lang are stackable now. #66

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
60 changes: 43 additions & 17 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import { useState, useEffect } from 'react';
import {useRef, useState, useEffect } from 'react';
import SKILLS from '../utils/skills';
import { ProfileCard } from '../components/ProfileCard';
import profiles from '../utils/profiles';
Expand All @@ -12,34 +12,50 @@ import Typewriter from 'typewriter-effect';

export default function Home() {
const [display, setDisplay] = useState("absolute");
const [lang, setLang] = useState();

const [tags , setTags] = useState([]);
const [profilesList, setProfiles] = useState();
let languages=new Set();



//Used to make sure that the inputs in profile.js are consitent for example html is equal to HTML
function checkLang(skill){
return skill.toUpperCase() == lang.toUpperCase();
}

useEffect(() => {
setLang(lang)
languages.add(lang)
let tmpList=[];
if(typeof(lang) != "undefined")
console.log(tags)
if(tags.length!=0)
{
console.log("1");

profiles.map((data, index) => {
if(data.skills.find(checkLang))

let tempBool = true;
tags.forEach(element => {
if(!data.skills.includes(element)){
tempBool= false;
}
});
if(tempBool)
{
tmpList.push(data);
}

})
if(tmpList.length == 0){
setProfiles([]);

}
else{
setProfiles(tmpList);
}
}
else
{
console.log("starting");

setProfiles(profiles);
}
})
},[tags])

useEffect(() => {
AOS.init()
Expand Down Expand Up @@ -99,17 +115,27 @@ export default function Home() {
<div className="flex flex-auto flex-wrap">


<div className="flex justify-center items-center m-1 font-medium py-1 px-2 bg-white rounded-full text-teal-700 border border-teal-300 ">
<div className="text-xs font-normal leading-none max-w-full flex-initial">{lang}</div>

{tags.map((item)=>{return ( <>
<div className="flex justify-center items-center m-1 font-medium py-1 px-2 bg-white rounded-full text-teal-700 border border-teal-300 ">
<div className="text-xs font-normal leading-none max-w-full flex-initial">{item}</div>


<div className="flex flex-auto flex-row-reverse">
<div onClick={()=>{setLang()}}>
<div onClick={()=>{
console.log("repeat me 1")
setTags(tags.filter(temp=>temp!=item));
}}>
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="feather feather-x cursor-pointer hover:text-teal-400 rounded-full w-4 h-4 ml-2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</div>
</div>
</div>
</div>

</> )})}


<div className="flex-1">
<input placeholder="" className="bg-transparent p-1 px-2 appearance-none outline-none h-full w-full text-gray-800" />
Expand All @@ -125,13 +151,13 @@ export default function Home() {
</div>
</div>
</div>
<div className={`${display === "hidden" ? "absolute" : "hidden"} shadow top-100 bg-white z-40 w-full lef-0 rounded max-h-select overflow-y-auto svelte-5uyqqj`}>
<div className={`${display === "hidden" ? "absolute" : "hidden"} shadow top-100 bg-white z-40 w-full lef-0 rounded max-h-select overflow-y-auto svelte-5uyqqj`}>
<div className="flex flex-col w-full">

{
SKILLS && SKILLS.map((skill, index) => {
return (
<div className="cursor-pointer w-full border-gray-100 rounded-t border-b hover:" onClick={() => { setLang(skill.name) }} key={index}>
<div className="cursor-pointer w-full border-gray-100 rounded-t border-b hover:" onClick={() => {console.log("repeat me two"); setTags([...tags,skill.name]) }} key={index}>
<div className="flex w-full items-center p-2 pl-2 border-transparent border-l-2 relative hover:border-teal-100">
<div className="w-full items-center flex">
<div className="mx-2 leading-6" data-skill={skill.name}>{skill.name}</div>
Expand Down