-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(releases): sorting release overview table (#7159)
* feat(releases): sorting releases table with new Table component * fix(releases): fixing sanity require for DocumentPerspectiveMenu.test * refactor(releases): clarifying generic names; minor tidies to naming * refactor(releases): default table data type of unknown; rename of some variables; improved types for TableProvider * refactor(releases): default table data type of unknown; rename of some variables; improved types for TableProvider
- Loading branch information
Showing
27 changed files
with
914 additions
and
871 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/sanity/src/_singletons/core/releases/ReleasesTableContext.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {createContext, useContext} from 'react' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export interface TableContextValue { | ||
searchTerm: string | null | ||
setSearchTerm: (searchTerm: string) => void | ||
sort: {column: string; direction: 'asc' | 'desc'} | null | ||
setSearchColumn: (column: string) => void | ||
} | ||
|
||
const DEFAULT_TABLE_CONTEXT: TableContextValue = { | ||
searchTerm: null, | ||
setSearchTerm: () => null, | ||
sort: null, | ||
setSearchColumn: () => null, | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const TableContext = createContext<TableContextValue | null>(null) | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const useTableContext = (): TableContextValue => { | ||
const context = useContext(TableContext) | ||
if (!context) { | ||
throw new Error('useTableContext must be used within a TableProvider') | ||
} | ||
return context || DEFAULT_TABLE_CONTEXT | ||
} |
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
73 changes: 0 additions & 73 deletions
73
packages/sanity/src/core/releases/components/ReleasesTable/ReleaseHeader.tsx
This file was deleted.
Oops, something went wrong.
94 changes: 0 additions & 94 deletions
94
packages/sanity/src/core/releases/components/ReleasesTable/ReleaseRow.tsx
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
packages/sanity/src/core/releases/components/ReleasesTable/ReleasesTable.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.