generated from sweetmantech/DACIRKUS_PERFORMERS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from SweetmanTech/test
Test
- Loading branch information
Showing
13 changed files
with
188 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import Media from "@/components/Core/Media" | ||
import useClickOutsideSelect from "@/hooks/useClickOutsideSelect" | ||
import Icon from "@/components/Core/Icon" | ||
import { useEmployee } from "@/providers/EmployeeProvider" | ||
import { milestones } from "@/hooks/useEmployeeData" | ||
import RecBar from "@/components/RecBar" | ||
|
||
const EmployeeContent = ({ isPopup = false }) => { | ||
const { selectRef, setIsVisibleSelect, isVisibleSelect } = useClickOutsideSelect() | ||
const { selectedValue, setSelectedValue } = useEmployee() | ||
|
||
const handleClick = (value) => { | ||
setSelectedValue(value) | ||
setIsVisibleSelect(!isVisibleSelect) | ||
} | ||
|
||
return ( | ||
<div className="p-[5px] md:p-[10px] border-[2px] border-gray_1 h-full"> | ||
<div | ||
className="border-[1px] border-darkgray text-gray_1 font-dresden | ||
py-[25px] text-center | ||
flex items-center justify-center text-[16px] relative h-full | ||
text-[12px] md:text-[16px] relative" | ||
> | ||
<div | ||
className="h-fit max-h-full text-[12px] md:text-[16px] | ||
px-[15px] md:px-[20px] flex flex-col | ||
flex flex-col items-center" | ||
> | ||
<Media | ||
type="image" | ||
link="/images/Landing/about.jpeg" | ||
blurLink="/images/Landing/about.jpeg" | ||
containerClasses={`${isPopup ? "w-[100px]" : "w-[150px] "} aspect-[4000/6016]`} | ||
/> | ||
<p className="mt-2">Employee ID: heno.eth</p> | ||
<p>Points: 111</p> | ||
<div ref={selectRef} className="relative"> | ||
<button | ||
type="button" | ||
onClick={() => setIsVisibleSelect(!isVisibleSelect)} | ||
className="border-[2px] px-3 py-1 rounded-sm flex items-center" | ||
> | ||
{selectedValue} | ||
<Icon name={`${isVisibleSelect ? "arrowUp" : "arrowDown"}`} raw /> | ||
</button> | ||
{isVisibleSelect && ( | ||
<div | ||
className="absolute left-0 top-full z-[100] border-[2px] | ||
w-full gap-2 rounded-sm space-y-2 py-1 bg-black" | ||
> | ||
{milestones.map((milestone) => ( | ||
<button type="button" onClick={() => handleClick(milestone)} key={milestone}> | ||
{milestone} | ||
</button> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
<RecBar cctvNumber={6} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default EmployeeContent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import useIsMobile from "@/hooks/useIsMobile" | ||
import Layout from "@/components/Layout" | ||
import SeoHead from "@/components/SeoHead" | ||
import EmployeeContent from "./EmployeeContent" | ||
|
||
const EmployeePage = () => { | ||
const isMobile = useIsMobile() | ||
|
||
return ( | ||
<Layout type={isMobile ? "mobile" : "base"}> | ||
<SeoHead title="HENO. Contact" image="/images/Landing/web3.jpeg" /> | ||
<EmployeeContent /> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default EmployeePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import EmployeePage from "./EmployeePage" | ||
|
||
export default EmployeePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useEffect, useRef, useState } from "react" | ||
|
||
const useClickOutsideSelect = () => { | ||
const selectRef = useRef() as any | ||
const [isVisibleSelect, setIsVisibleSelect] = useState(false) | ||
|
||
useEffect(() => { | ||
const handleClose = (e) => { | ||
if (selectRef.current && !selectRef.current.contains(e.target)) setIsVisibleSelect(false) | ||
} | ||
|
||
document.addEventListener("mousedown", handleClose) | ||
document.addEventListener("touchstart", handleClose) | ||
|
||
return () => { | ||
document.removeEventListener("mousedown", handleClose) | ||
document.removeEventListener("touchstart", handleClose) | ||
} | ||
}, [selectRef]) | ||
|
||
return { | ||
isVisibleSelect, | ||
setIsVisibleSelect, | ||
selectRef, | ||
} | ||
} | ||
|
||
export default useClickOutsideSelect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { useState } from "react" | ||
|
||
export const milestones = ["#Milestone 1", "#Milestone 2", "#Milestone 3"] | ||
|
||
const useEmployeeData = () => { | ||
const [selectedValue, setSelectedValue] = useState(milestones[0]) | ||
|
||
return { | ||
setSelectedValue, | ||
selectedValue, | ||
} | ||
} | ||
|
||
export default useEmployeeData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import EmployeePage from "@/components/Pages/EmployeePage" | ||
|
||
const Employee = () => <EmployeePage /> | ||
|
||
export default Employee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { createContext, useContext, useMemo } from "react" | ||
import useEmployeeData from "@/hooks/useEmployeeData" | ||
|
||
const EmployeeContext = createContext(null) | ||
|
||
const EmployeeProvider = ({ children }) => { | ||
const employeeData = useEmployeeData() | ||
|
||
const value = useMemo( | ||
() => ({ | ||
...employeeData, | ||
}), | ||
[employeeData], | ||
) | ||
|
||
return <EmployeeContext.Provider value={value}>{children}</EmployeeContext.Provider> | ||
} | ||
|
||
export const useEmployee = () => { | ||
const context = useContext(EmployeeContext) | ||
if (!context) { | ||
throw new Error("useEmployee must be used within a EmployeeProvider") | ||
} | ||
return context | ||
} | ||
|
||
export default EmployeeProvider |