mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(site): style overflowing tables
This commit is contained in:
@@ -1,17 +1,35 @@
|
||||
---
|
||||
import type { HTMLTag, Polymorphic } from "astro/types";
|
||||
import { clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import type { HTMLTag, Polymorphic } from 'astro/types';
|
||||
import { clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
type Props<Tag extends HTMLTag = 'table'> = Polymorphic<{ as: Tag }> & {
|
||||
maxWidth?: boolean;
|
||||
class?: string;
|
||||
type Props<Tag extends HTMLTag = "table"> = Polymorphic<{ as: Tag }> & {
|
||||
maxWidth?: boolean;
|
||||
class?: string;
|
||||
};
|
||||
|
||||
const { as: Tag = 'table', maxWidth = true, class: className, ...props } = Astro.props;
|
||||
const {
|
||||
as: Tag = "table",
|
||||
maxWidth = true,
|
||||
class: className,
|
||||
...props
|
||||
} = Astro.props;
|
||||
---
|
||||
|
||||
<Tag class={twMerge(clsx('w-full my-12 border-collapse', maxWidth && 'max-w-3xl mx-auto'), className)} {...props}>
|
||||
<slot />
|
||||
</Tag>
|
||||
<div class={clsx("my-12", maxWidth && "mx-auto max-w-3xl")}>
|
||||
<div class="overflow-x-auto flex -mx-6">
|
||||
<div
|
||||
class="sticky left-0 z-10 shrink-0 basis-6 bg-linear-to-r from-light-80 dark:from-dark-80 to-transparent pointer-events-none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</div>
|
||||
<Tag class={twMerge("w-full border-collapse", className)} {...props}>
|
||||
<slot />
|
||||
</Tag>
|
||||
<div
|
||||
class="sticky right-0 z-10 shrink-0 basis-6 bg-linear-to-l from-light-80 dark:from-dark-80 to-transparent pointer-events-none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -149,6 +149,13 @@ The blockquote element represents content that is quoted from another source, op
|
||||
| --------- | -------- | ------ |
|
||||
| _italics_ | **bold** | `code` |
|
||||
|
||||
When a table is really wide, it overflows nicely on mobile
|
||||
|
||||
| A | Table | With | A | Lot | Of | Columns |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| contentcontentcontent | contentcontentcontent | contentcontentcontent | contentcontentcontent | contentcontentcontent | contentcontentcontent | contentcontentcontent |
|
||||
|
||||
|
||||
### Code Blocks
|
||||
|
||||
we can use 3 backticks ``` in new line and write snippet and close with 3 backticks on new line and to highlight language specific syntax, write one word of language name after first 3 backticks, for eg. html, javascript, css, markdown, typescript, txt, bash
|
||||
@@ -445,4 +452,4 @@ import ServerCode from '@/components/Code/ServerCode.astro';
|
||||
</TabsPanel>
|
||||
<MyDemo client:visible />
|
||||
</TabsRoot>
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user