@@ -22,23 +22,8 @@ export interface IStyledBaseProps extends ThemeProps<DefaultTheme> {
2222 $type ?: Type ;
2323}
2424
25- const boxShadow = ( props : IStyledBaseProps ) => {
26- const { theme } = props ;
27- const { space, shadows, opacity } = theme ;
28- const offsetY = `${ space . base * 5 } px` ;
29- const blurRadius = `${ space . base * 7 } px` ;
30- const color = getColor ( {
31- hue : 'neutralHue' ,
32- shade : 1200 ,
33- light : { transparency : opacity [ 200 ] } ,
34- dark : { transparency : opacity [ 1000 ] } ,
35- theme
36- } ) ;
37-
38- return shadows . lg ( offsetY , blurRadius , color as string ) ;
39- } ;
40-
4125const colorStyles = ( { theme, $type, $isFloating } : IStyledBaseProps ) => {
26+ const { space, shadows, opacity } = theme ;
4227 let bgVariable ;
4328 let borderVariable ;
4429 let fgVariable ;
@@ -76,8 +61,21 @@ const colorStyles = ({ theme, $type, $isFloating }: IStyledBaseProps) => {
7661 const borderColor = getColor ( { variable : borderVariable , theme } ) ;
7762 const foregroundColor = getColor ( { variable : fgVariable , theme } ) ;
7863
64+ const offsetY = `${ space . base * 5 } px` ;
65+ const blurRadius = `${ space . base * 7 } px` ;
66+ const color = getColor ( {
67+ hue : 'neutralHue' ,
68+ shade : 1200 ,
69+ light : { transparency : opacity [ 200 ] } ,
70+ dark : { transparency : opacity [ 1000 ] } ,
71+ theme
72+ } ) ;
73+
74+ const boxShadow = shadows . lg ( offsetY , blurRadius , color ) ;
75+
7976 return css `
8077 border-color : ${ borderColor } ;
78+ box-shadow : ${ $isFloating && boxShadow } ;
8179 background-color : ${ backgroundColor } ;
8280 color : ${ foregroundColor } ;
8381 ` ;
@@ -98,7 +96,6 @@ export const StyledBase = styled.div.attrs({
9896 position: relative;
9997 border: ${ props => props . theme . borders . sm } ;
10098 border-radius: ${ props => props . theme . borderRadii . md } ;
101- box-shadow: ${ props => props . $isFloating && boxShadow } ;
10299 padding: ${ padding } ;
103100 line-height: ${ props => getLineHeight ( props . theme . space . base * 5 , props . theme . fontSizes . md ) } ;
104101 font-size: ${ props => props . theme . fontSizes . md } ;
0 commit comments