1- import { useMemo } from 'react' ;
21import { css } from 'styled-components' ;
32
43import { Box , Card } from '@/components' ;
5- import { useCunninghamTheme } from '@/cunningham/useCunninghamTheme' ;
64import { useDocStore } from '@/docs/doc-management/stores/useDocStore' ;
75import { DocShareButton } from '@/features/docs/doc-share/components/DocShareButton' ;
86import { LeftPanelCollapseButton } from '@/features/left-panel/components/LeftPanelCollapseButton' ;
@@ -11,6 +9,36 @@ import { useResponsiveStore } from '@/stores';
119
1210import { DocToolBox } from './DocToolBox' ;
1311
12+ const FLOATING_STYLES = css `
13+ position : sticky;
14+ top : 0 ;
15+ left : 0 ;
16+ right : 0 ;
17+ width : 100% ;
18+ padding : var (--c--globals--spacings--sm );
19+ padding-bottom : 0 ;
20+ z-index : 10 ; // Under editor select box but above other elements (e.g., doc title, suggestion menu)
21+ align-items : flex-start;
22+ isolation : isolate;
23+
24+ & ::before {
25+ content : '' ;
26+ position : absolute;
27+ inset : 0 ;
28+ z-index : -1 ;
29+ background : linear-gradient (180deg , # fff 0% , rgba (255 , 255 , 255 , 0 ) 100% );
30+ backdrop-filter : blur (1px );
31+ -webkit-backdrop-filter : blur (1px );
32+ mask-image : linear-gradient (180deg , black 50% , transparent 100% );
33+ -webkit-mask-image : linear-gradient (180deg , black 50% , transparent 100% );
34+ }
35+
36+ > * {
37+ position : relative;
38+ z-index : 1 ;
39+ }
40+ ` ;
41+
1442/**
1543 * Sticky bar trick (desktop):
1644 * - MainContent has padding `base`; we extend the bar width and apply
@@ -19,52 +47,10 @@ import { DocToolBox } from './DocToolBox';
1947 * Mobile: returns null to avoid header overlap.
2048 */
2149export const FloatingBar = ( ) => {
22- const { spacingsTokens } = useCunninghamTheme ( ) ;
2350 const { isLargeScreen } = useResponsiveStore ( ) ;
2451 const { currentDoc } = useDocStore ( ) ;
2552 const isDeletedDoc = ! ! currentDoc ?. deleted_at ;
2653
27- const FLOATING_STYLES = useMemo ( ( ) => {
28- const sm = spacingsTokens [ 'sm' ] ;
29- return css `
30- position : sticky;
31- top : 0 ;
32- left : 0 ;
33- right : 0 ;
34- width : 100% ;
35- min-height : 64px ;
36- padding : ${ sm } ;
37- z-index : 21 ; // Under editor select box but above other elements (e.g., doc title, suggestion menu)
38- align-items : flex-start;
39- isolation : isolate;
40-
41- & ::before {
42- content : '' ;
43- position : absolute;
44- inset : 0 ;
45- z-index : -1 ;
46- background : linear-gradient (
47- 180deg ,
48- # fff 0% ,
49- rgba (255 , 255 , 255 , 0 ) 100%
50- );
51- backdrop-filter : blur (1px );
52- -webkit-backdrop-filter : blur (1px );
53- mask-image : linear-gradient (180deg , black 50% , transparent 100% );
54- -webkit-mask-image : linear-gradient (
55- 180deg ,
56- black 50% ,
57- transparent 100%
58- );
59- }
60-
61- > * {
62- position : relative;
63- z-index : 1 ;
64- }
65- ` ;
66- } , [ spacingsTokens ] ) ;
67-
6854 return (
6955 < Box
7056 className = "--docs--floating-bar"
0 commit comments