-
Notifications
You must be signed in to change notification settings - Fork 0
formatted files and wrote some docs #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
publicJorn
wants to merge
3
commits into
main
Choose a base branch
from
formatting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,10 +5,7 @@ import '../../assets/table-sort-button.css';const n = "_button_158ku_1", r = "_s | |
| sorted: r, | ||
| desc: d, | ||
| asc: _ | ||
| }, i = ({ | ||
| state: o, | ||
| children: s | ||
| }) => /* @__PURE__ */ c( | ||
| }, i = ({ state: o, children: s }) => /* @__PURE__ */ c( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this is biome acting up again, but there shouldn't be any formatting changes in generated files from |
||
| "div", | ||
| { | ||
| className: e([ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,84 +1,82 @@ | ||
| import { jsxs as p, jsx as r } from "react/jsx-runtime"; | ||
| import b from "classnames"; | ||
| import { useState as u } from "react"; | ||
| import '../../assets/table.css';const k = "_table_1hpbm_1", _ = "_sticky_1hpbm_39", x = "_header_1hpbm_45", a = { | ||
| table: k, | ||
| sticky: _, | ||
| header: x | ||
| }, C = ({ | ||
| data: i, | ||
| import { jsxs as b, jsx as n } from "react/jsx-runtime"; | ||
| import k from "classnames"; | ||
| import { useState as _ } from "react"; | ||
| import '../../assets/table.css';const x = "_table_1hpbm_1", v = "_sticky_1hpbm_39", D = "_header_1hpbm_45", a = { | ||
| table: x, | ||
| sticky: v, | ||
| header: D | ||
| }, j = ({ | ||
| data: r, | ||
| columns: t, | ||
| makeKey: n, | ||
| makeKey: d, | ||
| className: o, | ||
| empty: f | ||
| }) => { | ||
| const [d, h] = m(t); | ||
| return /* @__PURE__ */ p( | ||
| const [i, S] = N(t); | ||
| return /* @__PURE__ */ b( | ||
| "table", | ||
| { | ||
| cellSpacing: "0", | ||
| className: b([a.table, o]), | ||
| className: k([a.table, o]), | ||
| style: { | ||
| // @ts-ignore Typescript doesnt like custom css vars | ||
| "--columns": t.length | ||
| }, | ||
| children: [ | ||
| /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: t.map((e, c) => { | ||
| const s = c === (d == null ? void 0 : d.index), S = d == null ? void 0 : d.direction, y = e.onSorted ? "button" : "div"; | ||
| return /* @__PURE__ */ r( | ||
| /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: t.map((e, c) => { | ||
| const s = c === (i == null ? void 0 : i.index), y = i == null ? void 0 : i.direction, p = e.onSorted ? "button" : "div"; | ||
| return /* @__PURE__ */ n( | ||
| "th", | ||
| { | ||
| scope: "col", | ||
| className: e.sticky ? a.sticky : void 0, | ||
| children: /* @__PURE__ */ r( | ||
| y, | ||
| children: /* @__PURE__ */ n( | ||
| p, | ||
| { | ||
| type: e.onSorted && "button", | ||
| className: a.header, | ||
| onClick: e.onSorted ? async () => { | ||
| const l = !s || (d == null ? void 0 : d.direction) !== "Desc" ? "Desc" : "Asc"; | ||
| await e.onSorted( | ||
| l | ||
| ), h({ | ||
| var h; | ||
| const l = !s || (i == null ? void 0 : i.direction) !== "Desc" ? "Desc" : "Asc"; | ||
| await ((h = e.onSorted) == null ? void 0 : h.call(e, l)), S({ | ||
| index: c, | ||
| direction: l | ||
| }); | ||
| } : void 0, | ||
| children: typeof e.title == "function" ? e.title({ | ||
| isSortedColumn: s, | ||
| direction: S | ||
| direction: y | ||
| }) : e.title | ||
| } | ||
| ) | ||
| }, | ||
| e.key | ||
| ); | ||
| }) }) }), | ||
| /* @__PURE__ */ r("tbody", { children: i != null && i.length ? i.map((e, c) => /* @__PURE__ */ r("tr", { children: t.map((s) => /* @__PURE__ */ r( | ||
| /* @__PURE__ */ n("tbody", { children: r != null && r.length ? r.map((e, c) => /* @__PURE__ */ n("tr", { children: t.map((s) => /* @__PURE__ */ n( | ||
| "td", | ||
| { | ||
| className: s.sticky ? a.sticky : void 0, | ||
| children: s.render(e) | ||
| }, | ||
| s.key | ||
| )) }, n(e, c))) : f }) | ||
| )) }, d(e, c))) : f }) | ||
| ] | ||
| } | ||
| ); | ||
| }, m = (i) => u(() => { | ||
| const t = i.findIndex( | ||
| }, N = (r) => _(() => { | ||
| const t = r.findIndex( | ||
| (o) => o.defaultSorted | ||
| ); | ||
| if (t === -1) return; | ||
| const n = i[t]; | ||
| return n.onSorted ? { | ||
| direction: n.defaultSorted === !0 ? "Desc" : n.defaultSorted || "Desc", | ||
| const d = r[t]; | ||
| return d.onSorted ? { | ||
| direction: d.defaultSorted === !0 ? "Desc" : d.defaultSorted || "Desc", | ||
| index: t | ||
| } : { | ||
| index: t, | ||
| direction: typeof n.defaultSorted == "string" ? n.defaultSorted : void 0 | ||
| direction: typeof d.defaultSorted == "string" ? d.defaultSorted : void 0 | ||
| }; | ||
| }); | ||
| export { | ||
| C as default | ||
| j as default | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| export { default as Table, type ColumnState, type OrderDirection, type TableColumn } from './components/table/table'; | ||
| export { type ColumnState, default as Table, type OrderDirection, type TableColumn, } from './components/table/table'; | ||
| export { default as TableSortButton } from './components/table/table-sort-button'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| pre-commit: | ||
| parallel: true | ||
| jobs: | ||
| - run: bun run biome check --no-errors-on-unmatched --files-ignore-unknown=true {staged_files} | ||
| - run: bun run prettier --check {staged_files} | ||
| glob: "**/*.{s,}css" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| .button { | ||
| transition: all 0.1s ease; | ||
| opacity: 0.5; | ||
| display: inline-block; | ||
| transition: all 0.1s ease; | ||
| opacity: 0.5; | ||
| display: inline-block; | ||
| } | ||
|
|
||
| .sorted { | ||
| opacity: 1; | ||
| opacity: 1; | ||
| } | ||
|
|
||
| .desc { | ||
| transform: rotateX(0deg); | ||
| transform: rotateX(0deg); | ||
| } | ||
|
|
||
| .asc { | ||
| transform: rotateX(180deg); | ||
| transform: rotateX(180deg); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,59 @@ | ||
| .table { | ||
| display: grid; | ||
| grid-template-columns: repeat( | ||
| var(--columns), | ||
| minmax(max-content, 1fr) | ||
| ); | ||
| place-items: center; | ||
| overflow-x: auto; | ||
| grid-auto-rows: min-content; | ||
|
|
||
| // Prevent depth/z-plane fighting | ||
| isolation: isolate; | ||
|
|
||
| thead, | ||
| tbody { | ||
| display: contents; | ||
| } | ||
|
|
||
| tr { | ||
| display: grid; | ||
| grid-template-columns: subgrid; | ||
| grid-column: 1 / -1; | ||
|
|
||
| &:hover td { | ||
| background-color: var(--color-primary-095); | ||
| } | ||
| } | ||
|
|
||
| td { | ||
| padding: var(--space-x-small) var(--space-small); | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| } | ||
|
|
||
| th { | ||
| padding: var(--space-small) 0; | ||
| font-weight: unset; | ||
| background-color: var(--color-primary-095); | ||
| border-bottom: 2px solid var(--color-neutral-080); | ||
| } | ||
|
|
||
| td { | ||
| background: var(--color-white); | ||
| border-bottom: 2px solid var(--color-neutral-090); | ||
| font: var(--font-body-small-regular); | ||
| } | ||
| display: grid; | ||
| grid-template-columns: repeat(var(--columns), minmax(max-content, 1fr)); | ||
| place-items: center; | ||
| overflow-x: auto; | ||
| grid-auto-rows: min-content; | ||
|
|
||
| // Prevent depth/z-plane fighting | ||
| isolation: isolate; | ||
|
|
||
| thead, | ||
| tbody { | ||
| display: contents; | ||
| } | ||
|
|
||
| tr { | ||
| display: grid; | ||
| grid-template-columns: subgrid; | ||
| grid-column: 1 / -1; | ||
|
|
||
| &:hover td { | ||
| background-color: var(--color-primary-095); | ||
| } | ||
| } | ||
|
|
||
| td { | ||
| padding: var(--space-x-small) var(--space-small); | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| } | ||
|
|
||
| th { | ||
| padding: var(--space-small) 0; | ||
| font-weight: unset; | ||
| background-color: var(--color-primary-095); | ||
| border-bottom: 2px solid var(--color-neutral-080); | ||
| } | ||
|
|
||
| td { | ||
| background: var(--color-white); | ||
| border-bottom: 2px solid var(--color-neutral-090); | ||
| font: var(--font-body-small-regular); | ||
| } | ||
| } | ||
|
|
||
| .sticky { | ||
| position: sticky; | ||
| inset-inline-start: 0; | ||
| z-index: 1; | ||
| position: sticky; | ||
| inset-inline-start: 0; | ||
| z-index: 1; | ||
| } | ||
|
|
||
| .header { | ||
| width: 100%; | ||
| border: none; | ||
| background: none; | ||
| text-align: start; | ||
| padding: 0; | ||
| width: 100%; | ||
| border: none; | ||
| background: none; | ||
| text-align: start; | ||
| padding: 0; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While of course this is good etiquette, I'm not sure I agree that we should push for memoization.
In my experience, it's almost never worth it in terms of performance, and often causes confusion for our colleagues when they don't quite understand the purpose and effects of it.
In the projects that uses this table, we don't really use memoization because of these points... Maybe we should do a "react hooks deep-dive" tech-talk to cover this? I could prepare one if you'd like.