Skip to content

Commit d1f9350

Browse files
authored
fix: broken mobile styling of the library redirect banner (#259)
* fix: broken mobile styling of the library version redirect banner * fix: on mobile reduce the gap between the primary redirect banner elements * fix: follow react rules and return null
1 parent 9c8d304 commit d1f9350

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

app/components/RedirectVersionBanner.tsx

+21-17
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export function RedirectVersionBanner(props: {
2121

2222
if (![latestVersion, 'latest'].includes(version) && showModal) {
2323
return (
24-
<div className="p-4 bg-white/70 text-black dark:bg-gray-500/40 dark:text-white shadow-xl shadow-black/20 flex items-center justify-center gap-4 fixed top-4 left-1/2 bottom-auto backdrop-blur-sm z-20 -translate-x-1/2 rounded-full overflow-hidden">
25-
<div>
24+
<div className="p-4 bg-white/70 text-black dark:bg-gray-500/40 dark:text-white shadow-xl shadow-black/20 flex items-center justify-center gap-2.5 lg:gap-4 fixed top-4 left-1/2 bottom-auto backdrop-blur-sm z-20 -translate-x-1/2 rounded-3xl lg:rounded-full overflow-hidden w-[80%] lg:w-auto">
25+
<p className="block">
2626
You are currently reading <strong>{version}</strong> docs. Redirect to{' '}
2727
<Link
2828
params={{
@@ -33,23 +33,27 @@ export function RedirectVersionBanner(props: {
3333
latest
3434
</Link>{' '}
3535
version?
36+
</p>
37+
<div className="flex gap-2 flex-col lg:flex-row items-center">
38+
<Link
39+
params={{
40+
version: 'latest',
41+
}}
42+
replace
43+
className="bg-black dark:bg-white dark:text-black text-white w-full lg:w-auto py-1 px-2 rounded-md uppercase font-black text-xs"
44+
>
45+
Latest
46+
</Link>
47+
<button
48+
onClick={() => setShowModal(false)}
49+
className="bg-black dark:bg-white dark:text-black text-white w-full lg:w-auto py-1 px-2 rounded-md uppercase font-black text-xs"
50+
>
51+
Hide
52+
</button>
3653
</div>
37-
<Link
38-
params={{
39-
version: 'latest',
40-
}}
41-
replace
42-
className="bg-black dark:bg-white dark:text-black text-white py-1 px-2 rounded-md uppercase font-black text-xs"
43-
>
44-
Latest
45-
</Link>
46-
<button
47-
onClick={() => setShowModal(false)}
48-
className="bg-black dark:bg-white dark:text-black text-white py-1 px-2 rounded-md uppercase font-black text-xs"
49-
>
50-
Hide
51-
</button>
5254
</div>
5355
)
5456
}
57+
58+
return null
5559
}

0 commit comments

Comments
 (0)