
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@zendeskgarden/container-pagination
Advanced tools
Containers relating to pagination in the Garden Design System
This package includes containers relating to pagination in the Garden Design System.
npm install @zendeskgarden/container-pagination
Check out storybook for live examples.
The usePagination
hook is wrapper on top of the useSelection
hook with
specific prop getters for pagination.
import { createRef, useRef } from 'react';
import { usePagination } from '@zendeskgarden/container-pagination';
const Pagination = () => {
const previousPageRef = useRef(null);
const nextPageRef = useRef(null);
const pageRefs = pages.map(() => createRef(null));
const {
selectedItem,
focusedItem,
getContainerProps,
getNextPageProps,
getPreviousPageProps,
getPageProps
} = usePagination();
// role="null" is applied due to implied role="navigation" semantics of <nav />
return (
<nav {...getContainerProps({ role: null })}>
<ul style={{ display: 'flex' }}>
<li
{...getPreviousPageProps({
current: selectedItem === 'prev',
focused: focusedItem === 'prev',
item: 'prev',
focusRef: previousPageRef,
ref: previousPageRef,
key: 'previous-page'
})}
>
Prev
</li>
{pages.map((page, index) => {
return (
<li
{...getPageProps({
focused: index === focusedItem,
current: index === selectedItem,
page: index,
item: index,
focusRef: pageRefs[index],
ref: pageRefs[index],
key: `page-${index}`,
style: {
outline: index === focusedItem && '3px solid red',
background: index === selectedItem && 'gray',
padding: '0 6px'
}
})}
>
{index + 1}
</li>
);
})}
<li
{...getNextPageProps({
current: selectedItem === 'next',
focused: focusedItem === 'next',
item: 'next',
focusRef: nextPageRef,
ref: nextPageRef,
key: 'next-page'
})}
>
Next
</li>
</ul>
</nav>
);
};
import { createRef, useRef } from 'react';
import { PaginationContainer } from '@zendeskgarden/container-pagination';
<PaginationContainer>
{({
selectedItem,
focusedItem,
getContainerProps,
getNextPageProps,
getPreviousPageProps,
getPageProps
}) => {
const previousPageRef = useRef(null);
const nextPageRef = useRef(null);
const pageRefs = pages.map(() => createRef(null));
// role="null" is applied due to implied role="navigation" semantics of <nav />
return (
<nav {...getContainerProps({ role: null })}>
<ul style={{ display: 'flex' }}>
<li
{...getPreviousPageProps({
current: selectedItem === 'prev',
focused: focusedItem === 'prev',
item: 'prev',
focusRef: previousPageRef,
ref: previousPageRef,
key: 'previous-page'
})}
>
Prev
</li>
{pages.map((page, index) => {
return (
<li
{...getPageProps({
focused: index === focusedItem,
current: index === selectedItem,
page: index,
item: index,
focusRef: pageRefs[index],
ref: pageRefs[index],
key: `page-${index}`,
style: {
outline: index === focusedItem && '3px solid red',
background: index === selectedItem && 'gray',
padding: '0 6px'
}
})}
>
{index + 1}
</li>
);
})}
<li
{...getNextPageProps({
current: selectedItem === 'next',
focused: focusedItem === 'next',
item: 'next',
focusRef: nextPageRef,
ref: nextPageRef,
key: 'next-page'
})}
>
Next
</li>
</ul>
</nav>
);
}}
</PaginationContainer>;
FAQs
Containers relating to pagination in the Garden Design System
The npm package @zendeskgarden/container-pagination receives a total of 2,063 weekly downloads. As such, @zendeskgarden/container-pagination popularity was classified as popular.
We found that @zendeskgarden/container-pagination demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.