-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve editor experience with page information (total entries …
…count + current entries length) (#4397)
- Loading branch information
Showing
19 changed files
with
191 additions
and
21 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
22 changes: 22 additions & 0 deletions
22
...p-headless-cms/src/admin/components/ContentEntries/BottomInfoBar/BottomInfoBar.styled.tsx
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,22 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
export const BottomInfoBarWrapper = styled("div")` | ||
font-size: 0.8rem; | ||
position: sticky; | ||
bottom: 0; | ||
height: 30px; | ||
color: var(--mdc-theme-text-secondary-on-background); | ||
border-top: 1px solid var(--mdc-theme-on-background); | ||
background: var(--mdc-theme-surface); | ||
width: 100%; | ||
transform: translateZ(0); | ||
overflow: hidden; | ||
display: flex; | ||
align-items: center; | ||
z-index: 1; | ||
`; | ||
|
||
export const BottomInfoBarInner = styled("div")` | ||
padding: 0 10px; | ||
width: 100%; | ||
`; |
23 changes: 23 additions & 0 deletions
23
...ages/app-headless-cms/src/admin/components/ContentEntries/BottomInfoBar/BottomInfoBar.tsx
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,23 @@ | ||
import React from "react"; | ||
import { ListMeta } from "./ListMeta"; | ||
import { BottomInfoBarInner, BottomInfoBarWrapper } from "./BottomInfoBar.styled"; | ||
|
||
interface BottomInfoBarProps { | ||
loading: boolean; | ||
totalCount: number; | ||
currentCount: number; | ||
} | ||
|
||
export const BottomInfoBar = (props: BottomInfoBarProps) => { | ||
return ( | ||
<BottomInfoBarWrapper> | ||
<BottomInfoBarInner> | ||
<ListMeta | ||
loading={props.loading} | ||
totalCount={props.totalCount} | ||
currentCount={props.currentCount} | ||
/> | ||
</BottomInfoBarInner> | ||
</BottomInfoBarWrapper> | ||
); | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/app-headless-cms/src/admin/components/ContentEntries/BottomInfoBar/ListMeta.tsx
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,19 @@ | ||
import React, { useCallback } from "react"; | ||
|
||
export interface ListMetaProps { | ||
loading: boolean; | ||
currentCount: number; | ||
totalCount: number; | ||
} | ||
|
||
export const ListMeta = (props: ListMetaProps) => { | ||
const getLabel = useCallback((count = 0): string => { | ||
return `${count} ${count === 1 ? "entry" : "entries"}`; | ||
}, []); | ||
|
||
if (props.loading) { | ||
return null; | ||
} | ||
|
||
return <span>{`Showing ${props.currentCount} out of ${getLabel(props.totalCount)}.`}</span>; | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/app-headless-cms/src/admin/components/ContentEntries/BottomInfoBar/index.tsx
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 "./BottomInfoBar"; |
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
11 changes: 2 additions & 9 deletions
11
packages/app-headless-cms/src/admin/components/ContentEntries/Table/styled.tsx
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,12 +1,5 @@ | ||
import styled from "@emotion/styled"; | ||
import { css } from "emotion"; | ||
|
||
import { ListItemGraphic as ListItemGraphicBase } from "@webiny/ui/List"; | ||
|
||
export const ListItemGraphic = styled(ListItemGraphicBase)` | ||
margin-right: 25px; | ||
export const TableContainer = styled.div` | ||
margin-bottom: 31px; | ||
`; | ||
|
||
export const menuStyles = css(` | ||
width: 200px; | ||
`); |
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
22 changes: 22 additions & 0 deletions
22
packages/app-page-builder/src/admin/components/BottomInfoBar/BottomInfoBar.styled.tsx
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,22 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
export const BottomInfoBarWrapper = styled("div")` | ||
font-size: 0.8rem; | ||
position: sticky; | ||
bottom: 0; | ||
height: 30px; | ||
color: var(--mdc-theme-text-secondary-on-background); | ||
border-top: 1px solid var(--mdc-theme-on-background); | ||
background: var(--mdc-theme-surface); | ||
width: 100%; | ||
transform: translateZ(0); | ||
overflow: hidden; | ||
display: flex; | ||
align-items: center; | ||
z-index: 1; | ||
`; | ||
|
||
export const BottomInfoBarInner = styled("div")` | ||
padding: 0 10px; | ||
width: 100%; | ||
`; |
23 changes: 23 additions & 0 deletions
23
packages/app-page-builder/src/admin/components/BottomInfoBar/BottomInfoBar.tsx
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,23 @@ | ||
import React from "react"; | ||
import { ListMeta } from "./ListMeta"; | ||
import { BottomInfoBarInner, BottomInfoBarWrapper } from "./BottomInfoBar.styled"; | ||
|
||
interface BottomInfoBarProps { | ||
loading: boolean; | ||
totalCount: number; | ||
currentCount: number; | ||
} | ||
|
||
export const BottomInfoBar = (props: BottomInfoBarProps) => { | ||
return ( | ||
<BottomInfoBarWrapper> | ||
<BottomInfoBarInner> | ||
<ListMeta | ||
loading={props.loading} | ||
totalCount={props.totalCount} | ||
currentCount={props.currentCount} | ||
/> | ||
</BottomInfoBarInner> | ||
</BottomInfoBarWrapper> | ||
); | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/app-page-builder/src/admin/components/BottomInfoBar/ListMeta.tsx
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,19 @@ | ||
import React, { useCallback } from "react"; | ||
|
||
export interface ListMetaProps { | ||
loading: boolean; | ||
currentCount: number; | ||
totalCount: number; | ||
} | ||
|
||
export const ListMeta = (props: ListMetaProps) => { | ||
const getLabel = useCallback((count = 0): string => { | ||
return `${count} ${count === 1 ? "page" : "pages"}`; | ||
}, []); | ||
|
||
if (props.loading) { | ||
return null; | ||
} | ||
|
||
return <span>{`Showing ${props.currentCount} out of ${getLabel(props.totalCount)}.`}</span>; | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/app-page-builder/src/admin/components/BottomInfoBar/index.tsx
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 "./BottomInfoBar"; |
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
5 changes: 5 additions & 0 deletions
5
packages/app-page-builder/src/admin/components/Table/Table/styled.tsx
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,5 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
export const TableContainer = styled.div` | ||
margin-bottom: 31px; | ||
`; |
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