Skip to content

Commit

Permalink
fix scrollbar for table and tabs (#1401)
Browse files Browse the repository at this point in the history
* fix scrollbar for table and tabs

* update snapsh0ts
  • Loading branch information
Dimitri POSTOLOV authored Jan 26, 2023
1 parent bcaba9c commit 086cf7b
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-balloons-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra-theme-docs': patch
---

fix scrollbar for table and tabs
21 changes: 21 additions & 0 deletions examples/swr-site/pages/docs/advanced/scrollbar-x.en-US.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Tabs, Tab } from 'nextra-theme-docs'

|**Student ID**|**First Name**|**Last Name**|**Major**|**GPA**|**Graduation Year**|**Email**|**Phone Number**|**Address**|**Date of Birth**|**Gender**|**Class Standing**|**Enrollment Status**|**Enrollment Date**|**Graduation Date**|**Advisor ID**|
|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|
| 12345|John|Doe|Computer Science|3.5|2024|[email protected]|555-555-5555|123 Main St, Anytown USA|01/01/2000|M|Junior|Full-time|01/01/2022|05/01/2024|54321|
| 67890|Jane|Smith|Biology|3.2|2023|[email protected]|555-555-5555|456 Park Ave, Anytown USA|02/02/1999|F|Senior|Full-time|01/01/2019|12/01/2022|56789|
| 11111|Bob|Johnson|Mathematics|3.7|2022|[email protected]|555-555-5555|789 Elm St, Anytown USA|03/03/1998|M|Senior|Part-time|01/01/2021|05/01/2022|98765|
| 22222|Samantha|Williams|Chemistry|3.3|2024|[email protected]|555-555-5555|321 Oak St, Anytown USA|04/04/1997|F|Junior|Full-time|01/01/2022|05/01/2024|54321|
| 33333|Michael|Brown|Political Science|3.0|2023|[email protected]|555-555-5555|159 Pine St, Anytown USA|05/05/1996|M|Senior|Full-time|01/01/2019|12/01/2022|56789|
| 44444|Ashley|Moore|Business|3.5|2022|[email protected]|555-555-5555|753 Birch St, Anytown USA|06/06/1995|F|Senior|Part-time|01/01/2021|05/01/2022|98765|
| 55555|David|Taylor|Engineering|3.9|2024|[email protected]|555-555-5555|964 Maple St, Anytown USA|07/07/1994|M|Junior|Full-time|01/01/2022|05/01/2024|54321|
| 77777|Jessica|Anderson|Communications|3.6|2023|[email protected]|555-555-5555|111 Cedar St, Anytown USA|08/08/1993|F|Senior|Full-time|01/01/2019|12/01/2022|56789|

<Tabs items={['name', 'version', 'private','dependencies','scripts','eslintConfig','browserslist','development' ,'name', 'version', 'private']}>
<Tab className='bg-red-500'>
dada
</Tab>
<Tab>
dadasd
</Tab>
</Tabs>
2 changes: 1 addition & 1 deletion packages/nextra-theme-docs/css/scrollbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

scrollbar-gutter: stable;
&::-webkit-scrollbar {
@apply nx-w-3 nx-h-1.5;
@apply nx-w-3 nx-h-3;
}
&::-webkit-scrollbar-track {
@apply nx-bg-transparent;
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-docs/src/components/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function Tabs({
defaultIndex={defaultIndex}
onChange={onChange}
>
<div className="no-scrollbar -nx-m-2 nx-overflow-x-auto nx-overflow-y-hidden nx-overscroll-x-contain nx-p-2">
<div className="nextra-scrollbar nx-overflow-x-auto nx-overflow-y-hidden nx-overscroll-x-contain">
<HeadlessTab.List className="nx-mt-4 nx-flex nx-w-max nx-min-w-full nx-border-b nx-border-gray-200 nx-pb-px dark:nx-border-neutral-800">
{items.map((item, index) => {
const disabled = !!(
Expand Down
18 changes: 18 additions & 0 deletions packages/nextra/__test__/__snapshots__/context.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,12 @@ exports[`context > getAllPages() > should work 1`] = `
"name": "react-native",
"route": "/docs/advanced/react-native",
},
{
"kind": "MdxPage",
"locale": "en-US",
"name": "scrollbar-x",
"route": "/docs/advanced/scrollbar-x",
},
],
"kind": "Folder",
"name": "advanced",
Expand Down Expand Up @@ -1412,6 +1418,12 @@ exports[`context > getCurrentLevelPages() > should work 1`] = `
"name": "react-native",
"route": "/docs/advanced/react-native",
},
{
"kind": "MdxPage",
"locale": "en-US",
"name": "scrollbar-x",
"route": "/docs/advanced/scrollbar-x",
},
],
"kind": "Folder",
"name": "advanced",
Expand Down Expand Up @@ -1672,5 +1684,11 @@ exports[`context > getPagesUnderRoute() > should work 1`] = `
"name": "react-native",
"route": "/docs/advanced/react-native",
},
{
"kind": "MdxPage",
"locale": "en-US",
"name": "scrollbar-x",
"route": "/docs/advanced/scrollbar-x",
},
]
`;
12 changes: 12 additions & 0 deletions packages/nextra/__test__/__snapshots__/page-map.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ exports[`Page Process > pageMap en-US 1`] = `
"name": "react-native",
"route": "/docs/advanced/react-native",
},
{
"kind": "MdxPage",
"locale": "en-US",
"name": "scrollbar-x",
"route": "/docs/advanced/scrollbar-x",
},
],
"kind": "Folder",
"name": "advanced",
Expand Down Expand Up @@ -901,6 +907,12 @@ exports[`Page Process > pageMap ru 1`] = `
"name": "markdown-import",
"route": "/docs/advanced/markdown-import",
},
{
"kind": "MdxPage",
"locale": "en-US",
"name": "scrollbar-x",
"route": "/docs/advanced/scrollbar-x",
},
],
"kind": "Folder",
"name": "advanced",
Expand Down

1 comment on commit 086cf7b

@vercel
Copy link

@vercel vercel bot commented on 086cf7b Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.