diff --git a/src/admin/components/elements/PerPage/index.scss b/src/admin/components/elements/PerPage/index.scss new file mode 100644 index 00000000000..dcfc7961f59 --- /dev/null +++ b/src/admin/components/elements/PerPage/index.scss @@ -0,0 +1,48 @@ +@import '../../../scss/styles.scss'; + +.per-page { + display: flex; + margin-bottom: $baseline; + margin-right: 0; + margin-left: auto; + + button { + padding: base(.25) 0; + line-height: base(1); + background: transparent; + border: 0; + font-weight: 600; + cursor: pointer; + + &:hover { + text-decoration: underline; + } + + &:active, + &:focus { + outline: none; + } + } + + span { + color: $color-gray; + } + + ul { + list-style: none; + padding: 0; + text-align: left; + margin: 0; + + li { + text-decoration: none; + } + + a { + color: $color-gray; + &:visited, &:link, &:active { + text-decoration: none; + } + } + } +} diff --git a/src/admin/components/elements/PerPage/index.tsx b/src/admin/components/elements/PerPage/index.tsx new file mode 100644 index 00000000000..1290819b528 --- /dev/null +++ b/src/admin/components/elements/PerPage/index.tsx @@ -0,0 +1,49 @@ +import React from 'react'; + +import './index.scss'; +import { Link } from 'react-router-dom'; +import Popup from '../Popup'; +import Chevron from '../../icons/Chevron'; + +const baseClass = 'per-page'; +type Props = { + valueOptions: number[]; +} + +const PerPage: React.FC = ({ valueOptions }) => ( +
+ + Per Page: + +
+ )} + backgroundColor="#333333" + render={({ close }) => ( +
+ +
+ )} + /> + +); + +export default PerPage; diff --git a/src/admin/components/elements/Popup/index.tsx b/src/admin/components/elements/Popup/index.tsx index 4353e62640c..caabeb0ae9e 100644 --- a/src/admin/components/elements/Popup/index.tsx +++ b/src/admin/components/elements/Popup/index.tsx @@ -23,6 +23,8 @@ const Popup: React.FC = (props) => { horizontalAlign = 'left', initActive = false, onToggleOpen, + backgroundColor, + padding, } = props; const buttonRef = useRef(null); @@ -98,7 +100,9 @@ const Popup: React.FC = (props) => { ].filter(Boolean).join(' '); return ( -
+
= (props) => {
-
-
+
+ +
{render && render({ close: () => setActive(false) })} {children && children}
diff --git a/src/admin/components/elements/Popup/types.ts b/src/admin/components/elements/Popup/types.ts index e851f4f639c..0f176345148 100644 --- a/src/admin/components/elements/Popup/types.ts +++ b/src/admin/components/elements/Popup/types.ts @@ -1,3 +1,5 @@ +import { CSSProperties } from 'react'; + export type Props = { className?: string render?: (any) => void, @@ -10,4 +12,6 @@ export type Props = { showOnHover?: boolean, initActive?: boolean, onToggleOpen?: () => void, + backgroundColor?: CSSProperties['backgroundColor'], + padding?: CSSProperties['padding'], } diff --git a/src/admin/components/views/collections/List/Default.tsx b/src/admin/components/views/collections/List/Default.tsx index 4d943695edb..8be1f780cbd 100644 --- a/src/admin/components/views/collections/List/Default.tsx +++ b/src/admin/components/views/collections/List/Default.tsx @@ -13,6 +13,7 @@ import { Props } from './types'; import './index.scss'; import ViewDescription from '../../../elements/ViewDescription'; +import PerPage from '../../../elements/PerPage'; const baseClass = 'collection-list'; @@ -114,6 +115,7 @@ const DefaultList: React.FC = (props) => {
)}
+ = (props) => { nextPage={data.nextPage} numberOfNeighbors={1} /> + {data?.totalDocs > 0 && (
{(data.page * data.limit) - (data.limit - 1)}