Skip to content

Commit

Permalink
Merge branch 'bose/2433' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Oct 3, 2024
2 parents 40605c4 + 804a464 commit 5c032c5
Show file tree
Hide file tree
Showing 33 changed files with 1,537 additions and 2,209 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions web/common/helpers/compare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const localeCompareUndefined = (a: any, b: any) => {

Check warning on line 1 in web/common/helpers/compare.ts

View workflow job for this annotation

GitHub Actions / check-code

Unexpected any. Specify a different type

Check warning on line 1 in web/common/helpers/compare.ts

View workflow job for this annotation

GitHub Actions / check-code

Unexpected any. Specify a different type
if (a === undefined && b === undefined) return 0
else if (a === undefined) return -1
else if (b === undefined) return 1
else return b - a
}
36 changes: 0 additions & 36 deletions web/components/src/Backgrounds/BackgroundContainer.test.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions web/components/src/Button/Button.test.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions web/components/src/Card/Card.test.tsx

This file was deleted.

61 changes: 0 additions & 61 deletions web/components/src/Table/Table.test.tsx

This file was deleted.

57 changes: 0 additions & 57 deletions web/components/src/Tabs/Tabs.test.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions web/components/src/Teaser/Teaser.test.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions web/components/src/Topbar/Topbar.test.tsx

This file was deleted.

67 changes: 67 additions & 0 deletions web/core/SimplePagination/SimplePagination.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import envisTwMerge from '../../twMerge'
import { useIntl } from 'react-intl'
import { MediaButton } from '@core/MediaButton/MediaButton'
import { useContext } from 'react'
import { PaginationContext } from '../../common/contexts/PaginationContext'
import { usePrefersReducedMotion } from '../../common/hooks/usePrefersReducedMotion'

export type SimplePaginationProps = {
className?: string
onNextPage: () => void
onPreviousPage: () => void
isFirstPage: boolean
isLastPage: boolean
}

export const SimplePagination = ({
className = '',
onNextPage,
onPreviousPage,
isFirstPage = false,
isLastPage = false,
...rest
}: SimplePaginationProps) => {
const intl = useIntl()
const { resultsRef } = useContext(PaginationContext)
const prefersReducedMotion = usePrefersReducedMotion()

const handleNextPagination = () => {
if (!prefersReducedMotion && resultsRef?.current) {
resultsRef.current.scrollIntoView({ behavior: 'smooth' })
}
onNextPage()
}
const handlePrevPagination = () => {
if (!prefersReducedMotion && resultsRef?.current) {
resultsRef.current.scrollIntoView({ behavior: 'smooth' })
}
onPreviousPage()
}

return (
<ul className={envisTwMerge(`max-w-viewport flex flex-wrap gap-2 my-2`, className)} {...rest}>
<div className="flex gap-3 items-center">
<MediaButton
title={intl.formatMessage({
id: 'previous',
defaultMessage: 'Previous',
})}
mode="previous"
disabled={isFirstPage}
onClick={handlePrevPagination}
className=""
/>
<MediaButton
title={intl.formatMessage({
id: 'next',
defaultMessage: 'Next',
})}
mode="next"
disabled={isLastPage}
onClick={handleNextPagination}
className=""
/>
</div>
</ul>
)
}
Loading

0 comments on commit 5c032c5

Please sign in to comment.