diff --git a/src/css/all.css b/src/css/all.css index 5884f6d44c..7f5102a860 100644 --- a/src/css/all.css +++ b/src/css/all.css @@ -792,6 +792,10 @@ content: "\f078"; } +.fa-chevron-up::before { + content: "\f077"; +} + .fa-circle-exclamation::before { content: "\f06a"; } diff --git a/src/css/custom.css b/src/css/custom.css index db6b08bbca..f43973b746 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -1775,3 +1775,7 @@ code:not(pre > code) { padding: 2px 5px; text-transform: capitalize; } + +.mantine-Modal-body code { + background-color: var(--mantine-color-gray-1) !important; +} \ No newline at end of file diff --git a/src/pages/index.module.scss b/src/pages/index.module.scss index ea1a562d8d..fedebfaec5 100644 --- a/src/pages/index.module.scss +++ b/src/pages/index.module.scss @@ -483,4 +483,4 @@ border: 0.75px solid var(--border-color); } } -} \ No newline at end of file +} diff --git a/src/theme/Tabs/index.tsx b/src/theme/Tabs/index.tsx index 2885aaf5d6..e1de6232d0 100644 --- a/src/theme/Tabs/index.tsx +++ b/src/theme/Tabs/index.tsx @@ -1,15 +1,46 @@ -import React, { cloneElement, useEffect } from "react"; -import clsx from "clsx"; -import { - useScrollPositionBlocker, - useTabs, - sanitizeTabsChildren, -} from "@docusaurus/theme-common/internal"; +import { sanitizeTabsChildren, useScrollPositionBlocker, useTabs } from "@docusaurus/theme-common/internal"; import useIsBrowser from "@docusaurus/useIsBrowser"; +import clsx from "clsx"; +import React, { cloneElement, useEffect, useRef, useState } from "react"; + import styles from "./styles.module.scss"; +import { Icon } from "@site/src/components/Icon"; + function TabList({ className, block, selectedValue, selectValue, tabValues }) { const tabRefs = []; const { blockElementScrollPositionUntilNextRender } = useScrollPositionBlocker(); + const [open, setOpen] = useState(false); + const [overflowing, setOverflowing] = useState(false); + const [width, setWidth] = useState(0); + const ulvalues = useRef(null); + + const calculateWidth = () => { + if (typeof document === "undefined") return 0; + return ((document.body.getBoundingClientRect().width - 300) * 0.75) - 48; // 48 is padding, 0.75 is 75% of content + }; + + useEffect(() => { + setWidth(calculateWidth()); + checkForOverflow(); + }, [width]); + + useEffect(() => { + const handleResize = () => { + const newWidth = calculateWidth(); + setWidth(newWidth); + }; + window.addEventListener("resize", handleResize); + return () => window.removeEventListener("resize", handleResize); + }, []); + + const checkForOverflow = () => { + if (ulvalues.current && width > 0) { + const contentWidth = ulvalues.current.getBoundingClientRect().width; + setOverflowing(contentWidth > width); + } + }; + + const handleTabChange = (event) => { const newTab = event.currentTarget; const newTabIndex = tabRefs.indexOf(newTab); @@ -18,6 +49,7 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) { blockElementScrollPositionUntilNextRender(newTab); selectValue(newTabValue); } + setOpen(false); }; const handleKeydown = (event) => { let focusElement = null; @@ -41,6 +73,12 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) { } focusElement?.focus(); }; + const handleOpen = (event) => { + const list = event.currentTarget; + setOpen(!open); + blockElementScrollPositionUntilNextRender(list); + } + return (