-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into test/O3-2428
- Loading branch information
Showing
12 changed files
with
167 additions
and
778 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
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
42 changes: 42 additions & 0 deletions
42
...es/esm-appointments-app/src/calendar/monthly/monthly-workload-view-expanded.component.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,42 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
import { Popover, PopoverContent } from '@carbon/react'; | ||
import styles from './monthly-view-workload.scss'; | ||
import MonthlyWorkloadView, { type MonthlyWorkloadViewProps } from './monthly-workload-view.component'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
interface MonthlyWorkloadViewExpandedProps extends MonthlyWorkloadViewProps { | ||
count: number; | ||
} | ||
|
||
const MonthlyWorkloadViewExpanded: React.FC<MonthlyWorkloadViewExpandedProps> = ({ count, events, dateTime }) => { | ||
const { t } = useTranslation(); | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
const popoverRef = useRef(null); | ||
|
||
const handleClickOutside = (event) => { | ||
if (popoverRef.current && !popoverRef.current.contains(event.target)) { | ||
setIsOpen(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
document.addEventListener('click', handleClickOutside); | ||
|
||
return () => { | ||
document.removeEventListener('click', handleClickOutside); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Popover open={isOpen} align="top" ref={popoverRef}> | ||
<button className={styles.showMoreItems} onClick={() => setIsOpen((prev) => !prev)}> | ||
{t('countMore', '{{count}} more', { count })} | ||
</button> | ||
<PopoverContent> | ||
<MonthlyWorkloadView events={events} dateTime={dateTime} showAllServices={true} /> | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default MonthlyWorkloadViewExpanded; |
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
Oops, something went wrong.