@@ -37,14 +37,20 @@ type WithShowExitIcon = { showExitIcon?: boolean };
3737const StyledModalHeader = styled ( Flex ) < {
3838 bigHeader ?: boolean ;
3939 scrolled : boolean ;
40+ floatingHeader ?: boolean ;
4041} > `
41- position: relative;
42+ position: ${ props => ( props . floatingHeader ? 'absolute' : ' relative' ) } ;
4243 font-family: var(--font-default);
4344 font-size: ${ props => ( props . bigHeader ? 'var(--font-size-h4)' : 'var(--font-size-xl)' ) } ;
4445 font-weight: 500;
4546 text-align: center;
4647 line-height: 18px;
47-
48+ background-color: ${ props =>
49+ props . floatingHeader && ! props . scrolled
50+ ? 'var(--transparent-color)'
51+ : 'var(--modal-background-content-color)' } ;
52+ width: ${ props => ( props . floatingHeader ? '-webkit-fill-available' : 'auto' ) } ;
53+ transition-duration: var(--default-duration);
4854 z-index: 3;
4955
5056 &::after {
@@ -54,15 +60,12 @@ const StyledModalHeader = styled(Flex)<{
5460 bottom: -16px; // bottom and height have to match for the border to be correctly placed
5561 height: 16px; // bottom and height have to match for the border to be correctly placed
5662 width: 100%;
57- ${ props =>
58- props . scrolled
59- ? 'background: linear-gradient(to bottom, var(--modal-shadow-color), transparent)'
60- : '' } ;
63+ transition-duration: var(--default-duration);
64+ background: linear-gradient(to bottom, var(--modal-shadow-color), transparent);
65+
6166 pointer-events: none;
67+ opacity: ${ props => ( ! props . scrolled ? '0' : '1' ) } ;
6268 }
63-
64- border-bottom: ${ props =>
65- props . scrolled ? '1px solid var(--border-color)' : '1px solid var(--transparent-color)' } ;
6669` ;
6770
6871export enum WrapperModalWidth {
@@ -309,28 +312,28 @@ export const ModalBasicHeader = ({
309312 bigHeader,
310313 modalHeaderDataTestId,
311314 extraRightButton,
315+ floatingHeader,
312316} : WithShowExitIcon &
313317 WithExtraRightButton &
314318 WithExtraLeftButton & {
315319 title ?: ReactNode ;
316320 bigHeader ?: boolean ;
321+ floatingHeader ?: boolean ;
317322 modalHeaderDataTestId ?: SessionDataTestId ;
318323 } ) => {
319- const htmlDirection = useHTMLDirection ( ) ;
320-
321324 const onClose = useOnModalClose ( ) ;
322325 const scrolled = useIsModalScrolled ( ) ;
323326
324327 return (
325328 < StyledModalHeader
326329 data-testid = { modalHeaderDataTestId }
327- dir = { htmlDirection }
328330 $container = { true }
329331 $flexDirection = { 'row' }
330332 $justifyContent = { 'space-between' }
331333 $alignItems = { 'center' }
332- padding = { 'var(--margins-lg) var(--margins-sm) var(--margins-sm) var(--margins-lg)' }
334+ padding = { 'var(--margins-lg) var(--margins-lg) var(--margins-sm) var(--margins-lg)' }
333335 bigHeader = { bigHeader }
336+ floatingHeader = { floatingHeader }
334337 scrolled = { scrolled }
335338 >
336339 < Flex
@@ -410,6 +413,7 @@ export const SessionWrapperModal = (props: SessionWrapperModalType & { onClose?:
410413 const [ scrolled , setScrolled ] = useState ( false ) ;
411414 const modalRef = useRef < HTMLDivElement > ( null ) ;
412415
416+ const htmlDirection = useHTMLDirection ( ) ;
413417 const isTopModal = useIsTopModal ( modalId ) ;
414418
415419 useKey ( ( event : KeyboardEvent ) => {
@@ -440,6 +444,7 @@ export const SessionWrapperModal = (props: SessionWrapperModalType & { onClose?:
440444 onMouseDown = { handleClick }
441445 role = "dialog"
442446 data-testid = { modalDataTestId }
447+ dir = { htmlDirection }
443448 >
444449 < StyledModal
445450 $contentMaxWidth = { $contentMaxWidth }
0 commit comments