docs: fix z-index across projects (#5234)

* docs: fix z-index across projects

* remove usage of z-index in UI docs
This commit is contained in:
Shahed Nasser authored and GitHub committed 2023-09-27 16:38:59 +03:00
1 parent c68ba63c1b
commit 6942a907a5
17 files changed
+34 -22

No files matched your search

@@ -33,13 +33,17 @@ export default function RootLayout({
className={clsx( className={clsx(
inter.variable, inter.variable,
robotoMono.variable, robotoMono.variable,
"bg-docs-bg font-base text-medium h-full w-full", "bg-docs-bg font-base text-medium w-full",
"text-medusa-fg-subtle" "text-medusa-fg-subtle",
"h-screen overflow-hidden"
)} )}
> >
<Providers> <Providers>
<div className="w-full">
<Navbar /> <Navbar />
<div
className="w-full h-[calc(100%-57px)] overflow-y-scroll"
id="main"
>
<div className="max-w-xxl mx-auto flex w-full px-1.5"> <div className="max-w-xxl mx-auto flex w-full px-1.5">
<Sidebar /> <Sidebar />
<main className="lg:w-ref-main relative mt-4 w-full flex-1 lg:mt-7"> <main className="lg:w-ref-main relative mt-4 w-full flex-1 lg:mt-7">
@@ -43,6 +43,7 @@ const TagOperation = ({
const { ref } = useInView({ const { ref } = useInView({
threshold: 0.3, threshold: 0.3,
rootMargin: `112px 0px 112px 0px`, rootMargin: `112px 0px 112px 0px`,
root: document.getElementById("main") || document.body,
onChange: (changedInView) => { onChange: (changedInView) => {
if (changedInView) { if (changedInView) {
if (!show) { if (!show) {
@@ -43,6 +43,7 @@ const TagSection = ({ tag }: TagSectionProps) => {
const { ref } = useInView({ const { ref } = useInView({
threshold: 0.5, threshold: 0.5,
rootMargin: `112px 0px 112px 0px`, rootMargin: `112px 0px 112px 0px`,
root: document.getElementById("main") || document.body,
onChange: (inView) => { onChange: (inView) => {
if (inView && !loadPaths) { if (inView && !loadPaths) {
setLoadPaths(true) setLoadPaths(true)
@@ -60,6 +60,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
], ],
}, },
], ],
className: "z-[500]",
}} }}
initialDefaultFilters={defaultFilters} initialDefaultFilters={defaultFilters}
> >
+2 -2
View File
@@ -31,11 +31,11 @@ export default function RootLayout({
<html lang="en" className="h-full w-full"> <html lang="en" className="h-full w-full">
<head /> <head />
<body <body
className={`bg-docs-bg h-screen w-full ${inter.variable} ${robotoMono.variable}`} className={`bg-docs-bg h-screen overflow-hidden w-full ${inter.variable} ${robotoMono.variable}`}
> >
<Providers> <Providers>
<div className="w-full">
<Navbar /> <Navbar />
<div className="w-full h-[calc(100%-57px)] overflow-y-scroll">
<div className="max-w-xxl grid w-full grid-cols-1 px-6 lg:mx-auto lg:grid-cols-[280px_1fr]"> <div className="max-w-xxl grid w-full grid-cols-1 px-6 lg:mx-auto lg:grid-cols-[280px_1fr]">
<Sidebar expandItems={true} /> <Sidebar expandItems={true} />
<div className="relative flex w-full flex-1 items-start justify-center px-4 pb-8 pt-16 md:px-8 lg:px-16 lg:py-[112px]"> <div className="relative flex w-full flex-1 items-start justify-center px-4 pb-8 pt-16 md:px-8 lg:px-16 lg:py-[112px]">
-1
View File
@@ -18,7 +18,6 @@ const Navbar = () => {
setMobileSidebarOpen, setMobileSidebarOpen,
mobileSidebarOpen, mobileSidebarOpen,
}} }}
className="!z-[49]"
/> />
) )
} }
@@ -6,7 +6,7 @@ export default function FocusModalDemo() {
<FocusModal.Trigger asChild> <FocusModal.Trigger asChild>
<Button>Edit Variant</Button> <Button>Edit Variant</Button>
</FocusModal.Trigger> </FocusModal.Trigger>
<FocusModal.Content className="z-[100]"> <FocusModal.Content>
<FocusModal.Header> <FocusModal.Header>
<Button>Save</Button> <Button>Save</Button>
</FocusModal.Header> </FocusModal.Header>
+4 -1
View File
@@ -3,7 +3,10 @@
echo "VERCEL_ENV: $VERCEL_ENV" echo "VERCEL_ENV: $VERCEL_ENV"
echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF" echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF"
$(git diff HEAD^ HEAD --quiet .) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "SCRIPT_DIR: $SCRIPT_DIR"
$(git diff HEAD^ HEAD --quiet ${SCRIPT_DIR})
diffResult=$? diffResult=$?
echo "DIFF RESULT: $diffResult" echo "DIFF RESULT: $diffResult"
@@ -97,7 +97,7 @@ export const CodeBlock = ({
</pre> </pre>
<div <div
className={clsx( className={clsx(
"absolute z-50 hidden gap-docs_1 md:flex", "absolute z-[1] hidden gap-docs_1 md:flex",
tokens.length === 1 && "right-docs_0.75 top-[10px]", tokens.length === 1 && "right-docs_0.75 top-[10px]",
tokens.length > 1 && "right-docs_1 top-docs_1" tokens.length > 1 && "right-docs_1 top-docs_1"
)} )}
@@ -49,7 +49,7 @@ export const Details = ({
}} }}
className={clsx( className={clsx(
"border-medusa-border-base border-y border-solid border-x-0", "border-medusa-border-base border-y border-solid border-x-0",
"overflow-hidden [&>summary]:relative [&>summary]:z-[398]", "overflow-hidden [&>summary]:relative",
props.className props.className
)} )}
> >
@@ -87,7 +87,7 @@ export const Modal = ({
{...props} {...props}
className={clsx( className={clsx(
"fixed top-0 left-0 flex h-screen w-screen items-center justify-center", "fixed top-0 left-0 flex h-screen w-screen items-center justify-center",
"bg-medusa-bg-overlay z-[500]", "bg-medusa-bg-overlay",
"hidden open:flex border-0 p-0", "hidden open:flex border-0 p-0",
className className
)} )}
@@ -31,14 +31,14 @@ export const Navbar = ({
return ( return (
<nav <nav
className={clsx( className={clsx(
"h-navbar sticky top-0 w-full justify-between", "h-navbar w-full justify-between",
"bg-docs-bg dark:bg-docs-bg-dark border-medusa-border-base z-[400] border-b", "bg-docs-bg dark:bg-docs-bg-dark border-medusa-border-base border-b",
className className
)} )}
> >
<div <div
className={clsx( className={clsx(
"h-navbar max-w-xxl py-docs_0.75 sticky top-0 mx-auto flex w-full justify-between px-docs_1 lg:px-docs_3" "h-navbar max-w-xxl py-docs_0.75 mx-auto flex w-full justify-between px-docs_1 lg:px-docs_3"
)} )}
> >
<div className="hidden w-full items-center gap-docs_0.5 lg:flex lg:w-auto lg:gap-docs_1.5"> <div className="hidden w-full items-center gap-docs_0.5 lg:flex lg:w-auto lg:gap-docs_1.5">
@@ -38,7 +38,7 @@ export const NotificationItem = ({
className={clsx( className={clsx(
"md:max-w-[320px] md:w-[320px] w-full bg-medusa-bg-base rounded-docs_DEFAULT", "md:max-w-[320px] md:w-[320px] w-full bg-medusa-bg-base rounded-docs_DEFAULT",
"shadow-flyout dark:shadow-flyout-dark max-h-[calc(100vh-90px)]", "shadow-flyout dark:shadow-flyout-dark max-h-[calc(100vh-90px)]",
"fixed md:right-docs_1 left-0 z-[400] md:m-docs_1", "fixed md:right-docs_1 left-0 md:m-docs_1",
placement === "bottom" && "md:bottom-docs_1 bottom-0", placement === "bottom" && "md:bottom-docs_1 bottom-0",
placement === "top" && "md:top-docs_1 top-0", placement === "top" && "md:top-docs_1 top-0",
"opacity-100 transition-opacity duration-200 ease-ease", "opacity-100 transition-opacity duration-200 ease-ease",
@@ -52,11 +52,11 @@ export const NotificationContainer = () => {
<> <>
{renderFilteredNotifications( {renderFilteredNotifications(
(notification) => notification.placement === "top", (notification) => notification.placement === "top",
"flex fixed flex-col gap-docs_0.5 right-0 top-0 z-[400] md:w-auto w-full max-h-[calc(100vh-57px)] overflow-y-auto" "flex fixed flex-col gap-docs_0.5 right-0 top-0 md:w-auto w-full max-h-[calc(100vh-57px)] overflow-y-auto"
)} )}
{renderFilteredNotifications( {renderFilteredNotifications(
(notification) => notification.placement !== "top", (notification) => notification.placement !== "top",
"flex flex-col gap-docs_0.5 fixed right-0 bottom-0 z-[400] md:w-auto w-full max-h-[calc(100vh-57px)] overflow-y-auto" "flex flex-col gap-docs_0.5 fixed right-0 bottom-0 md:w-auto w-full max-h-[calc(100vh-57px)] overflow-y-auto"
)} )}
</> </>
) )
@@ -19,6 +19,7 @@ export type SearchModalProps = {
suggestions: SearchSuggestionType[] suggestions: SearchSuggestionType[]
checkInternalPattern?: RegExp checkInternalPattern?: RegExp
filterOptions?: OptionType[] filterOptions?: OptionType[]
className?: string
} }
export const SearchModal = ({ export const SearchModal = ({
@@ -27,6 +28,7 @@ export const SearchModal = ({
isLoading = false, isLoading = false,
checkInternalPattern, checkInternalPattern,
filterOptions = [], filterOptions = [],
className,
}: SearchModalProps) => { }: SearchModalProps) => {
const modalRef = useRef<HTMLDialogElement | null>(null) const modalRef = useRef<HTMLDialogElement | null>(null)
const { isOpen, setIsOpen, defaultFilters, searchClient } = useSearch() const { isOpen, setIsOpen, defaultFilters, searchClient } = useSearch()
@@ -194,6 +196,7 @@ export const SearchModal = ({
open={isOpen} open={isOpen}
onClose={() => setIsOpen(false)} onClose={() => setIsOpen(false)}
passedRef={modalRef} passedRef={modalRef}
className={className}
> >
<InstantSearch <InstantSearch
indexName={algolia.mainIndexName} indexName={algolia.mainIndexName}
@@ -115,7 +115,7 @@ export const SelectDropdown = ({
<div <div
className={clsx( className={clsx(
"absolute top-full left-0 w-full", "absolute top-full left-0 w-full",
"z-10 h-0 translate-y-0 overflow-hidden transition-transform", "h-0 translate-y-0 overflow-hidden transition-transform",
open && "h-auto translate-y-docs_0.5 !overflow-visible", open && "h-auto translate-y-docs_0.5 !overflow-visible",
className className
)} )}
@@ -22,9 +22,9 @@ export const Sidebar = ({
className={clsx( className={clsx(
"clip bg-docs-bg dark:bg-docs-bg-dark w-ref-sidebar block", "clip bg-docs-bg dark:bg-docs-bg-dark w-ref-sidebar block",
"border-medusa-border-base border-0 border-r border-solid", "border-medusa-border-base border-0 border-r border-solid",
"fixed -left-full top-[57px] h-screen transition-[left] lg:relative lg:left-0 lg:top-auto lg:h-auto", "fixed -left-full top-0 h-screen transition-[left] lg:relative lg:left-0 lg:top-auto lg:h-auto",
"lg:w-sidebar z-[100] w-full lg:z-0", "lg:w-sidebar w-full",
mobileSidebarOpen && "!left-0", mobileSidebarOpen && "!left-0 z-50 top-[57px]",
!desktopSidebarOpen && "!absolute !-left-full", !desktopSidebarOpen && "!absolute !-left-full",
className className
)} )}
@@ -34,7 +34,7 @@ export const Sidebar = ({
> >
<ul <ul
className={clsx( className={clsx(
"sticky top-[57px] h-screen max-h-screen w-full list-none overflow-auto p-0", "sticky top-0 h-screen max-h-screen w-full list-none overflow-auto p-0",
"px-docs_1.5 pb-[57px] pt-docs_1.5" "px-docs_1.5 pb-[57px] pt-docs_1.5"
)} )}
id="sidebar" id="sidebar"