-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored completely the testing strategy, added 100-ish tests
- Loading branch information
1 parent
64dfbc1
commit 2f1eee2
Showing
24 changed files
with
2,826 additions
and
228 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import clsx from "clsx" | ||
import { useSettingsContext } from "../context/useRDTContext" | ||
import { useOnWindowResize } from "../hooks/useOnWindowResize" | ||
|
||
export const Breakpoints = () => { | ||
const { width } = useOnWindowResize() | ||
const { settings } = useSettingsContext() | ||
const breakpoints = settings.breakpoints | ||
const show = settings.showBreakpointIndicator | ||
const breakpoint = breakpoints.find((bp) => bp.min <= width && bp.max >= width) | ||
if (!breakpoint || !breakpoint.name || !show) { | ||
return null | ||
} | ||
return ( | ||
<div | ||
className={clsx( | ||
"flex fixed bottom-0 left-0 mb-5 rounded-full bg-[#212121] z-[9998] size-10 text-white flex items-center justify-center items-center gap-2 mx-1" | ||
)} | ||
> | ||
{breakpoint?.name} | ||
</div> | ||
) | ||
} |
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,33 @@ | ||
import clsx from "clsx" | ||
import { Link, useLocation } from "react-router" | ||
import { useSettingsContext } from "../context/useRDTContext" | ||
|
||
export const LiveUrls = () => { | ||
const { settings } = useSettingsContext() | ||
const location = useLocation() | ||
const envsPosition = settings.liveUrlsPosition | ||
const envsClassName = { | ||
"bottom-0": envsPosition === "bottom-left" || envsPosition === "bottom-right", | ||
"top-0": envsPosition === "top-left" || envsPosition === "top-right", | ||
"right-0": envsPosition === "bottom-right" || envsPosition === "top-right", | ||
"left-0": envsPosition === "bottom-left" || envsPosition === "top-left", | ||
} | ||
if (settings.liveUrls.length === 0) return null | ||
return ( | ||
<div className={clsx("flex fixed items-center z-[9998] gap-2 px-2", envsClassName)}> | ||
{settings.liveUrls.map((env) => { | ||
return ( | ||
<Link | ||
key={env.name} | ||
referrerPolicy="no-referrer" | ||
target="_blank" | ||
to={env.url + location.pathname} | ||
className="flex transition-all hover:text-gray-500 items-center gap-2 text-sm font-semibold text-gray-400" | ||
> | ||
{env.name} | ||
</Link> | ||
) | ||
})} | ||
</div> | ||
) | ||
} |
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,28 @@ | ||
import { useEffect, useState } from "react" | ||
|
||
type WindowSize = { | ||
width: number | ||
height: number | ||
} | ||
export const useOnWindowResize = () => { | ||
const [windowSize, setWindowSize] = useState<WindowSize>({ | ||
width: window.innerWidth, | ||
height: window.innerHeight, | ||
}) | ||
|
||
useEffect(() => { | ||
const handleResize = () => { | ||
setWindowSize({ | ||
width: window.innerWidth, | ||
height: window.innerHeight, | ||
}) | ||
} | ||
|
||
window.addEventListener("resize", handleResize) | ||
|
||
return () => { | ||
window.removeEventListener("resize", handleResize) | ||
} | ||
}, []) | ||
return windowSize | ||
} |
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
Oops, something went wrong.