-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate to tanstack router * all features: generate rows in a loader
- Loading branch information
Showing
42 changed files
with
997 additions
and
273 deletions.
There are no files selected for viewing
This file contains 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,3 @@ | ||
*.js | ||
*.json | ||
/website/routeTree.gen.ts |
This file contains 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 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 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 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
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,11 @@ | ||
import { createContext, useContext } from 'react'; | ||
|
||
import type { Direction } from '../src/types'; | ||
|
||
const DirectionContext = createContext<Direction>('ltr'); | ||
|
||
export const DirectionContextProvider = DirectionContext.Provider; | ||
|
||
export function useDirection(): Direction { | ||
return useContext(DirectionContext); | ||
} |
This file contains 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 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 @@ | ||
export * from './renderCoordinates'; |
2 changes: 1 addition & 1 deletion
2
website/demos/renderers/renderCoordinates.ts → website/renderers/renderCoordinates.ts
This file contains 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 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,82 +1,38 @@ | ||
import './root.css'; | ||
|
||
import { StrictMode, useState } from 'react'; | ||
import { StrictMode } from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { Navigate, Route, HashRouter as Router, Routes } from 'react-router-dom'; | ||
import { css } from '@linaria/core'; | ||
import { | ||
createHashHistory, | ||
createRouter, | ||
ErrorComponent, | ||
RouterProvider | ||
} from '@tanstack/react-router'; | ||
|
||
import type { Direction } from '../src/types'; | ||
import AllFeatures from './demos/AllFeatures'; | ||
import Animation from './demos/Animation'; | ||
import CellNavigation from './demos/CellNavigation'; | ||
import ColumnGrouping from './demos/ColumnGrouping'; | ||
import ColumnSpanning from './demos/ColumnSpanning'; | ||
import ColumnsReordering from './demos/ColumnsReordering'; | ||
import CommonFeatures from './demos/CommonFeatures'; | ||
import ContextMenuDemo from './demos/ContextMenu'; | ||
import CustomizableRenderers from './demos/CustomizableRenderers'; | ||
import HeaderFilters from './demos/HeaderFilters'; | ||
import InfiniteScrolling from './demos/InfiniteScrolling'; | ||
import MasterDetail from './demos/MasterDetail'; | ||
import MillionCells from './demos/MillionCells'; | ||
import NoRows from './demos/NoRows'; | ||
import ResizableGrid from './demos/Resizable'; | ||
import RowGrouping from './demos/RowGrouping'; | ||
import RowsReordering from './demos/RowsReordering'; | ||
import ScrollToCell from './demos/ScrollToCell'; | ||
import TreeView from './demos/TreeView'; | ||
import VariableRowHeight from './demos/VariableRowHeight'; | ||
import Nav from './Nav'; | ||
import { routeTree } from './routeTree.gen'; | ||
|
||
const mainClassname = css` | ||
display: flex; | ||
flex-direction: column; | ||
box-sizing: border-box; | ||
block-size: 100vh; | ||
padding: 8px; | ||
contain: inline-size; | ||
`; | ||
const router = createRouter({ | ||
routeTree, | ||
history: createHashHistory(), | ||
caseSensitive: true, | ||
defaultErrorComponent: ErrorComponent, | ||
defaultNotFoundComponent: NotFound, | ||
defaultPreload: 'intent' | ||
}); | ||
|
||
function Root() { | ||
const [direction, setDirection] = useState<Direction>('ltr'); | ||
return ( | ||
<Router> | ||
<Nav direction={direction} onDirectionChange={setDirection} /> | ||
<main className={mainClassname} dir={direction}> | ||
<Routes> | ||
<Route index element={<Navigate to="common-features" replace />} /> | ||
<Route path="common-features" element={<CommonFeatures direction={direction} />} /> | ||
<Route path="all-features" element={<AllFeatures direction={direction} />} /> | ||
<Route path="cell-navigation" element={<CellNavigation direction={direction} />} /> | ||
<Route path="column-spanning" element={<ColumnSpanning direction={direction} />} /> | ||
<Route path="column-grouping" element={<ColumnGrouping direction={direction} />} /> | ||
<Route path="columns-reordering" element={<ColumnsReordering direction={direction} />} /> | ||
<Route path="context-menu" element={<ContextMenuDemo direction={direction} />} /> | ||
<Route | ||
path="customizable-renderers" | ||
element={<CustomizableRenderers direction={direction} />} | ||
/> | ||
<Route path="row-grouping" element={<RowGrouping direction={direction} />} /> | ||
<Route path="header-filters" element={<HeaderFilters direction={direction} />} /> | ||
<Route path="infinite-scrolling" element={<InfiniteScrolling direction={direction} />} /> | ||
<Route path="master-detail" element={<MasterDetail direction={direction} />} /> | ||
<Route path="million-cells" element={<MillionCells direction={direction} />} /> | ||
<Route path="no-rows" element={<NoRows direction={direction} />} /> | ||
<Route path="resizable-grid" element={<ResizableGrid direction={direction} />} /> | ||
<Route path="rows-reordering" element={<RowsReordering direction={direction} />} /> | ||
<Route path="scroll-to-cell" element={<ScrollToCell direction={direction} />} /> | ||
<Route path="tree-view" element={<TreeView direction={direction} />} /> | ||
<Route path="variable-row-height" element={<VariableRowHeight direction={direction} />} /> | ||
<Route path="animation" element={<Animation direction={direction} />} /> | ||
<Route path="*" element="Nothing to see here" /> | ||
</Routes> | ||
</main> | ||
</Router> | ||
); | ||
// Register the router instance for type safety | ||
declare module '@tanstack/react-router' { | ||
interface Register { | ||
router: typeof router; | ||
} | ||
} | ||
|
||
function NotFound() { | ||
return 'Nothing to see here'; | ||
} | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<Root /> | ||
<RouterProvider router={router} /> | ||
</StrictMode> | ||
); |
Oops, something went wrong.