mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
simplified page padding scheme
This commit is contained in:
30 files changed
+129
-196
No files matched your search
@@ -1,17 +1,13 @@
|
||||
.scroller {
|
||||
/* Fits the table, centered by the parent, never wider than the page */
|
||||
max-width: 100%;
|
||||
|
||||
border: var(--space-0) solid var(--gray-a5);
|
||||
border-radius: var(--space-3);
|
||||
/* Clips the corners without becoming a scroll container, so sticky headers follow the page */
|
||||
overflow: clip;
|
||||
}
|
||||
|
||||
.table {
|
||||
border-radius: var(--space-3);
|
||||
overflow: hidden;
|
||||
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
|
||||
width: fit-content;
|
||||
margin: auto;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: var(--space-3);
|
||||
|
||||
@@ -13,16 +13,12 @@ import { Logo } from "../../icons/Logo";
|
||||
import { SortDirection } from "../../stores/tankopediaPersistent";
|
||||
import { CharacteristicRanking } from "../../types/characteristics";
|
||||
import { classNames } from "../../ui/classNames";
|
||||
import { Scroller, ScrollerOrientation } from "../Scroller";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface RootProps
|
||||
extends Omit<ComponentProps<typeof Scroller>, "orientation"> {
|
||||
scrollable?: boolean;
|
||||
}
|
||||
interface RootProps extends ComponentProps<"table"> {}
|
||||
|
||||
// When scrollable, scrolls both ways, keeping the head, the row headers and the group titles in view
|
||||
function Root({ children, className, scrollable, ...props }: RootProps) {
|
||||
function Root({ children, className, ...props }: RootProps) {
|
||||
const table = useRef<HTMLTableElement>(null);
|
||||
|
||||
// Group titles stick right below the head, whatever its height
|
||||
@@ -42,30 +38,12 @@ function Root({ children, className, scrollable, ...props }: RootProps) {
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
const content = (
|
||||
|
||||
return (
|
||||
<table ref={table} className={styles.table}>
|
||||
{children}
|
||||
</table>
|
||||
);
|
||||
|
||||
if (!scrollable) {
|
||||
return (
|
||||
<div className={classNames(styles.scroller, className)} {...props}>
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Scroller
|
||||
orientation={ScrollerOrientation.Both}
|
||||
startCurtain={false}
|
||||
className={classNames(styles.scroller, className)}
|
||||
{...props}
|
||||
>
|
||||
{content}
|
||||
</Scroller>
|
||||
);
|
||||
}
|
||||
|
||||
function Head(props: ComponentProps<"thead">) {
|
||||
|
||||
Reference in new issue
Block a user