diff --git a/.changeset/hungry-files-drive.md b/.changeset/hungry-files-drive.md new file mode 100644 index 0000000000..866252c3e8 --- /dev/null +++ b/.changeset/hungry-files-drive.md @@ -0,0 +1,7 @@ +--- +'nextra': patch +'nextra-theme-blog': patch +'nextra-theme-docs': patch +--- + +add `overflow-x-scroll` for tables diff --git a/.changeset/wise-fireants-hunt.md b/.changeset/wise-fireants-hunt.md new file mode 100644 index 0000000000..348026eb92 --- /dev/null +++ b/.changeset/wise-fireants-hunt.md @@ -0,0 +1,5 @@ +--- +'nextra-theme-docs': patch +--- + +reuse nextra's scrollbar-y styles for scrollbar-x, adjust sidebar's scrollbar-y diff --git a/examples/blog/pages/posts/table.mdx b/examples/blog/pages/posts/table.mdx index 68f0977091..4ac777209b 100644 --- a/examples/blog/pages/posts/table.mdx +++ b/examples/blog/pages/posts/table.mdx @@ -8,8 +8,8 @@ author: Dimitri POSTOLOV ## Test table -| Left | Center | Right | -| ---- | :----: | ----: | -| ss2 | 333 | 3232 | -| | 222 | 3232 | -| | 23 | | +| Left | Center | Right | Right | Right | Right | Right | Right | Right | Right | +| ---- | :----: | ----: | ----: | ----: | ----: | ----: | ----: | ----: | ----: | +| ss2 | 333 | 3232 | 3232 | 3232 | 3232 | 3232 | 3232 | 3232 | 3232 | +| | 222 | 3232 | 3232 | 3232 | 3232 | 3232 | 3232 | 3232 | 3232 | +| | 23 | | | | | | | | | diff --git a/packages/nextra-theme-blog/src/mdx-theme.tsx b/packages/nextra-theme-blog/src/mdx-theme.tsx index 9fc97fc5c1..cff01524c0 100644 --- a/packages/nextra-theme-blog/src/mdx-theme.tsx +++ b/packages/nextra-theme-blog/src/mdx-theme.tsx @@ -12,7 +12,7 @@ import React, { import { MDXProvider } from '@mdx-js/react' import Link from 'next/link' import { createPortal } from 'react-dom' -import { Code, Pre, Td, Th, Tr } from 'nextra/components' +import { Code, Pre, Table, Td, Th, Tr } from 'nextra/components' import { useBlogContext } from './blog-context' export const HeadingContext = createContext< @@ -68,19 +68,17 @@ const components = { h5: createHeaderLink('h5'), h6: createHeaderLink('h6'), a: A, - pre({ children, ...props }: ComponentProps<'pre'>) { - return ( -
-
{children}
-
- ) - }, + pre: ({ children, ...props }: ComponentProps<'pre'>) => ( +
+
{children}
+
+ ), tr: Tr, th: Th, td: Td, - table(props: ComponentProps<'table'>) { - return - }, + table: (props: ComponentProps<'table'>) => ( +
+ ), code: Code } diff --git a/packages/nextra-theme-docs/css/scrollbar.css b/packages/nextra-theme-docs/css/scrollbar.css index 25a426d740..99c8a982d5 100644 --- a/packages/nextra-theme-docs/css/scrollbar.css +++ b/packages/nextra-theme-docs/css/scrollbar.css @@ -1,41 +1,32 @@ .nextra-scrollbar { scrollbar-gutter: stable; &::-webkit-scrollbar { - width: 6px; + @apply w-1.5 h-1.5; } &::-webkit-scrollbar-track { - margin-top: 20px; - margin-bottom: 16px; - background-color: transparent; + @apply bg-transparent my-5; } &::-webkit-scrollbar-thumb { - box-shadow: inset 0 0 0 5px rgba(128, 128, 128, 0); - border-radius: 20px; + @apply rounded-[20px]; } &:hover::-webkit-scrollbar-thumb { - box-shadow: inset 0 0 0 5px rgba(128, 128, 128, 0.2); - &:hover { - box-shadow: inset 0 0 0 5px rgba(128, 128, 128, 0.4); - } + @apply shadow-[inset_0_0_0_5px_var(--tw-shadow-color)]; + @apply shadow-neutral-500/20 hover:shadow-neutral-500/40; } -} - -.nextra-sidebar-container.with-menu.nextra-scrollbar::-webkit-scrollbar-track { - margin-bottom: 76px; -} -@media (max-width: 767px) { - .nextra-container .nextra-scrollbar { - scrollbar-gutter: auto; + @media (max-width: 767px) { + .nextra-container & { + scrollbar-gutter: auto; + } } } /* Hide scrollbar */ .no-scrollbar { - -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; /* IE and Edge */ &::-webkit-scrollbar { - display: none; /* Chrome, Safari and Opera */ + @apply hidden; /* Chrome, Safari and Opera */ } } diff --git a/packages/nextra-theme-docs/src/components/head.tsx b/packages/nextra-theme-docs/src/components/head.tsx index a4c97299a8..bf8b52c58c 100644 --- a/packages/nextra-theme-docs/src/components/head.tsx +++ b/packages/nextra-theme-docs/src/components/head.tsx @@ -53,6 +53,8 @@ export function Head(): ReactElement {