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

[HOS-211] Mobile view + docs hosting banner fix #1078

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
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
20 changes: 13 additions & 7 deletions pcweb/components/hosting_banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ class HostingBannerState(rx.State):
show_banner: bool = True

def hide_banner(self):
print("hide_banner")
self.show_banner = False


def hosting_banner() -> rx.Component:
return rx.cond(
HostingBannerState.show_banner,
rx.desktop_only(rx.box(
rx.box(
rx.link(
rx.box(
rx.text(""),
rx.text(
"Reflex Cloud - ",
rx.el.span(
Expand All @@ -35,14 +34,21 @@ def hosting_banner() -> rx.Component:
),
rx.el.button(
"Launching Soon",
class_name="text-slate-11 h-[1.5rem] rounded-md bg-slate-4 px-1.5 text-sm font-semibold z-[1]",
class_name="text-slate-11 h-[1.5rem] rounded-md bg-slate-4 px-1.5 text-sm font-semibold z-[1] items-center justify-center shrink-0",
),
class_name="flex items-center gap-4",
),
href="/hosting",
underline="none",
class_name="mr-7 lg:mr-0",
),
rx.icon(
"x",
on_click=HostingBannerState.hide_banner,
size=16,
class_name="z-[1] cursor-pointer hover:!text-slate-11 transition-color !text-slate-9 absolute right-4",
),
rx.icon("x", on_click=HostingBannerState.hide_banner, size=16, color=rx.color("slate", 9), class_name="absolute right-4 z-[1]"),
glow(),
class_name="px-4 lg:px-6 w-screen h-auto lg:h-[40px] shadow-[inset_0_-1px_0_0_var(--c-slate-3)] flex items-center justify-center bg-slate-1 flex-row gap-4 overflow-hidden relative lg:py-0 py-2 max-w-full",
))
class_name="px-4 lg:px-6 w-screen h-auto lg:h-[3.5rem] shadow-[inset_0_-1px_0_0_var(--c-slate-3)] flex items-center justify-center bg-slate-1 flex-row gap-4 overflow-hidden relative lg:py-0 py-2 max-w-full",
),
)
23 changes: 19 additions & 4 deletions pcweb/templates/docpage/docpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def breadcrumb(path: str, nav_sidebar: rx.Component):
class_name="font-sm text-slate-8 mobile-only",
)
)

from pcweb.components.hosting_banner import HostingBannerState
# Return the list of breadcrumb items with separators
return rx.box(
docs_sidebar_drawer(
Expand All @@ -303,7 +303,11 @@ def breadcrumb(path: str, nav_sidebar: rx.Component):
rx.icon(tag="chevron-down", size=14, class_name="!text-slate-9"),
class_name="p-[0.563rem] mobile-only",
),
class_name="relative z-10 flex flex-row justify-between items-center gap-4 lg:gap-0 border-slate-4 bg-slate-1 mt-12 lg:mt-[119px] mb-6 lg:mb-12 p-[0.5rem_1rem_0.5rem_1rem] lg:p-0 border-b lg:border-none w-full",
class_name="relative z-10 flex flex-row justify-between items-center gap-4 lg:gap-0 border-slate-4 bg-slate-1 mt-12 mb-6 lg:mb-12 p-[0.5rem_1rem_0.5rem_1rem] lg:p-0 border-b lg:border-none w-full" + rx.cond(
HostingBannerState.show_banner,
" lg:mt-[175px]",
" lg:mt-[119px]",
),
)


Expand Down Expand Up @@ -414,6 +418,7 @@ def wrapper(*args, **kwargs) -> rx.Component:
from pcweb.components.docpage.navbar import navbar
from pcweb.components.docpage.sidebar import get_prev_next
from pcweb.components.docpage.sidebar import sidebar as sb
from pcweb.components.hosting_banner import HostingBannerState

# Create the docpage sidebar.
sidebar = sb(url=path, width="300px")
Expand Down Expand Up @@ -494,7 +499,12 @@ def wrapper(*args, **kwargs) -> rx.Component:
rx.el.main(
rx.box(
sidebar,
class_name="mt-[90px] h-full shrink-0 desktop-only lg:w-[24%]",
class_name="h-full shrink-0 desktop-only lg:w-[24%]"
+ rx.cond(
HostingBannerState.show_banner,
" mt-[146px]",
" mt-[90px]",
),
),
rx.box(
rx.box(
Expand Down Expand Up @@ -567,7 +577,12 @@ def wrapper(*args, **kwargs) -> rx.Component:
),
class_name="fixed flex flex-col justify-start gap-4 p-[0.875rem_0.5rem_0px_0.5rem] w-full max-w-[300px] max-h-[80vh] overflow-hidden",
),
class_name="mt-[90px] h-full shrink-0 w-[16%]"
class_name="h-full shrink-0 w-[16%]"
+ rx.cond(
HostingBannerState.show_banner,
" mt-[146px]",
" mt-[90px]",
)
+ (" hidden xl:flex" if right_sidebar else " hidden"),
),
class_name="justify-center flex flex-row mx-auto mt-0 max-w-[94.5em] h-full min-h-screen w-full",
Expand Down
Loading