-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataViews: Refactor to prepare exposing the underlying UI pieces (#63694
) Co-authored-by: youknowriad <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: ntsekouras <[email protected]>
- Loading branch information
1 parent
43569d2
commit 6a2a1db
Showing
33 changed files
with
1,354 additions
and
1,291 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
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
45 changes: 45 additions & 0 deletions
45
packages/dataviews/src/components/dataviews-bulk-actions-toolbar/style.scss
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,45 @@ | ||
.dataviews-bulk-actions-toolbar { | ||
position: sticky; | ||
display: flex; | ||
flex-direction: column; | ||
align-content: center; | ||
flex-wrap: wrap; | ||
width: fit-content; | ||
margin-left: auto; | ||
margin-right: auto; | ||
bottom: $grid-unit-30; | ||
z-index: z-index(".dataviews-bulk-actions-toolbar"); | ||
|
||
.components-accessible-toolbar { | ||
border-color: $gray-300; | ||
box-shadow: $shadow-popover; | ||
|
||
.components-toolbar-group { | ||
border-color: $gray-200; | ||
|
||
&:last-child { | ||
border: 0; | ||
} | ||
} | ||
} | ||
|
||
.dataviews-bulk-actions-toolbar__selection-count { | ||
display: flex; | ||
align-items: center; | ||
margin: 0 $grid-unit-10 0 $grid-unit-10; | ||
} | ||
} | ||
|
||
.dataviews-bulk-actions-toolbar__wrapper { | ||
display: flex; | ||
flex-grow: 1; | ||
width: 100%; | ||
|
||
.components-toolbar-group { | ||
align-items: center; | ||
} | ||
|
||
.components-button.is-busy { | ||
max-height: $button-size; | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
packages/dataviews/src/components/dataviews-bulk-actions/style.scss
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,7 @@ | ||
.dataviews-bulk-actions__modal { | ||
z-index: z-index(".dataviews-bulk-actions__modal"); | ||
} | ||
|
||
.dataviews-bulk-actions__edit-button.components-button { | ||
flex-shrink: 0; | ||
} |
47 changes: 47 additions & 0 deletions
47
packages/dataviews/src/components/dataviews-context/index.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,47 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createContext } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { View, Action, NormalizedField } from '../../types'; | ||
import type { SetSelection } from '../../private-types'; | ||
import { LAYOUT_TABLE } from '../../constants'; | ||
|
||
type DataViewsContextType< Item > = { | ||
view: View; | ||
onChangeView: ( view: View ) => void; | ||
fields: NormalizedField< Item >[]; | ||
actions?: Action< Item >[]; | ||
data: Item[]; | ||
isLoading?: boolean; | ||
paginationInfo: { | ||
totalItems: number; | ||
totalPages: number; | ||
}; | ||
selection: string[]; | ||
onChangeSelection: SetSelection; | ||
openedFilter: string | null; | ||
setOpenedFilter: ( openedFilter: string | null ) => void; | ||
getItemId: ( item: Item ) => string; | ||
}; | ||
|
||
const DataViewsContext = createContext< DataViewsContextType< any > >( { | ||
view: { type: LAYOUT_TABLE }, | ||
onChangeView: () => {}, | ||
fields: [], | ||
data: [], | ||
paginationInfo: { | ||
totalItems: 0, | ||
totalPages: 0, | ||
}, | ||
selection: [], | ||
onChangeSelection: () => {}, | ||
setOpenedFilter: () => {}, | ||
openedFilter: null, | ||
getItemId: ( item ) => item.id, | ||
} ); | ||
|
||
export default DataViewsContext; |
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
Oops, something went wrong.