Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add id property in Pager, Page and OrderBy component #432

Merged
merged 5 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add id property in Pager, Page and OrderBy component
  • Loading branch information
LupitaL committed Sep 4, 2024
commit 7001a53fd8d40c7c4de0d16609291e2b9172d29d
2 changes: 1 addition & 1 deletion lib/OrderBy/OrderBy.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class OrderBy extends React.Component {
<div onClick={this.stopPropagation} className={`${classes.cardWrap}${display ? ` ${classes.show}` : ''}`}>
<Card className={classes.card}>
{options.map(option => (
<div className={classes.option} key={option.value} onClick={() => { this.onChange(option.value); }}>
<div className={classes.option} key={option.value} onClick={() => { this.onChange(option.value); }} id={id ? `${id}${option.text}` : undefined}>
LupitaL marked this conversation as resolved.
Show resolved Hide resolved
<Text className={option.value === selected ? classes.link: ''} value={option.value}>{option.text}</Text>
</div>
))}
Expand Down
4 changes: 3 additions & 1 deletion lib/Pager/Page/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const Page = ({
onClick,
selected,
page,
disabled
disabled,
id
}) => (
<button
className={`${classes.page}${
Expand All @@ -16,6 +17,7 @@ const Page = ({
disabled={disabled}
tabIndex={onClick ? 0 : -1}
onClick={onClick}
id={id ? `${id}${page}` : undefined}
>
{page}
</button>
Expand Down
8 changes: 6 additions & 2 deletions lib/Pager/Pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default function Pager({
breakSymbol = '...',
hideNumbers,
disabled,
className
className,
id
}) {
const handlePageSelected = useCallback(
(newPage) => {
Expand Down Expand Up @@ -107,6 +108,7 @@ export default function Pager({
onClick={handlePrevPage}
icon="arrow-left"
size={!previousLabel ? 'lg' : 'sm'}
id={id ? `${id}Anterior` : undefined}
>
{previousLabel}
</Button>
Expand All @@ -120,10 +122,11 @@ export default function Pager({
selected={selected}
page={Number(key)}
disabled={disabled}
id={id}
/>
);
}
return <Page key={key} page={breakSymbol} disabled={disabled} />;
return <Page key={key} page={breakSymbol} disabled={disabled} id={id} />;
})
}
<Button
Expand All @@ -133,6 +136,7 @@ export default function Pager({
onClick={handleNextPage}
iconRight="arrow-right"
size={!nextLabel ? 'lg' : 'sm'}
id={id ? `${id}Siguiente` : undefined}
>
{nextLabel}
</Button>
Expand Down