-
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 #9 from Fingertips18/development
Add change password API route; fix tooltip dropshadow and dynamic colors
- Loading branch information
Showing
26 changed files
with
372 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { useState } from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
interface PageSwitcherProps { | ||
label?: string; | ||
tag: string; | ||
href: string; | ||
disabled?: boolean; | ||
isPrimary?: boolean; | ||
isAccent?: boolean; | ||
} | ||
|
||
const PageSwitcher = ({ | ||
label, | ||
tag, | ||
href, | ||
disabled, | ||
isPrimary, | ||
isAccent, | ||
}: PageSwitcherProps) => { | ||
const [hovered, setHovered] = useState(false); | ||
|
||
let color; | ||
|
||
if (isPrimary) { | ||
color = "primary"; | ||
} else if (isAccent) { | ||
color = "accent"; | ||
} else { | ||
color = "secondary"; | ||
} | ||
|
||
return ( | ||
<div | ||
className="p-4 w-full text-sm lg:text-base rounded-md border flex-center drop-shadow-2xl gap-x-2" | ||
style={{ | ||
borderColor: `rgb(var(--${color})/0.5)`, | ||
backgroundColor: `rgb(var(--${color})/0.15)`, | ||
}} | ||
> | ||
{label && <p className="font-medium">{label}</p>} | ||
<Link | ||
to={href} | ||
replace | ||
onMouseEnter={() => setHovered(true)} | ||
onMouseLeave={() => setHovered(false)} | ||
className={`font-bold underline-offset-4 hover:underline transition-all | ||
${disabled && `pointer-events-none`} | ||
`} | ||
style={{ | ||
filter: hovered | ||
? `drop-shadow(0 0px 25px rgb(var(--${color}))) drop-shadow(0 0px 50px rgb(var(--${color})))` | ||
: "none", | ||
color: disabled ? `rgb(var(--${color})/0.5)` : `rgb(var(--${color}))`, | ||
}} | ||
> | ||
{tag} | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export { PageSwitcher }; |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
export type ChangeDTO = { | ||
email: string; | ||
old_password: string; | ||
new_password: string; | ||
}; |
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,29 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
const useResize = () => { | ||
const [size, setSize] = useState({ | ||
width: 0, | ||
height: 0, | ||
}); | ||
|
||
const getSize = () => { | ||
setSize({ | ||
width: window.innerWidth, | ||
height: window.innerHeight, | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
getSize(); | ||
|
||
window.addEventListener("resize", getSize); | ||
|
||
return () => { | ||
window.removeEventListener("resize", getSize); | ||
}; | ||
}, []); | ||
|
||
return size; | ||
}; | ||
|
||
export { useResize }; |
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
11 changes: 11 additions & 0 deletions
11
client/src/pages/change-password/_components/change-password-back.tsx
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,11 @@ | ||
import { PageSwitcher } from "@/components/page-switcher"; | ||
import { useAuthStore } from "@/lib/stores/auth-store"; | ||
import { AppRoutes } from "@/constants/routes"; | ||
|
||
const ChangePasswordBack = () => { | ||
const { loading } = useAuthStore(); | ||
|
||
return <PageSwitcher href={AppRoutes.Root} tag="Back" disabled={loading} />; | ||
}; | ||
|
||
export { ChangePasswordBack }; |
Oops, something went wrong.