@@ -14,18 +14,40 @@ import {
1414 useDarkMode ,
1515} from '@mongodb-js/compass-components' ;
1616
17+ /**
18+ * @param color 6-digit hex color code
19+ * @param opacity a number between 0 and 1 representing the opacity
20+ * @returns 8-digit hex color code with the last two digits representing the opacity
21+ */
22+ function getColorWithOpactity ( color : string , opacity : number ) {
23+ if ( opacity < 0 || opacity > 1 ) {
24+ throw new Error ( 'Opacity must be between 0 and 1' ) ;
25+ }
26+ const alpha = Math . round ( opacity * 255 )
27+ . toString ( 16 )
28+ . padStart ( 2 , '0' ) ;
29+ return `#${ color . replace ( '#' , '' ) } ${ alpha } ` ;
30+ }
31+
1732const containerStyles = css ( {
1833 display : 'flex' ,
1934 justifyContent : 'space-between' ,
2035 alignItems : 'center' ,
2136 padding : `${ spacing [ 150 ] } px ${ spacing [ 200 ] } px` ,
2237 backgroundColor : palette . gray . light3 ,
2338 borderBottom : `1px solid ${ palette . gray . light2 } ` ,
39+ marginBottom : spacing [ 50 ] ,
40+ boxShadow : `0px ${ spacing [ 50 ] } px ${ spacing [ 100 ] } px -${
41+ spacing [ 25 ]
42+ } px ${ getColorWithOpactity ( palette . black , 0.15 ) } `,
2443} ) ;
2544
2645const containerDarkStyles = css ( {
2746 backgroundColor : palette . gray . dark3 ,
2847 borderBottom : `1px solid ${ palette . gray . dark2 } ` ,
48+ boxShadow : `0px ${ spacing [ 50 ] } px ${ spacing [ 100 ] } px -${
49+ spacing [ 25 ]
50+ } px ${ getColorWithOpactity ( palette . white , 0.15 ) } `,
2951} ) ;
3052
3153const toolbarGroupStyles = css ( {
0 commit comments