@@ -5,22 +5,22 @@ import {sanitizeCustomProperties} from '../../utilities/css';
55
66import styles from './Bleed.scss' ;
77
8- interface Spacing {
9- bottom : SpacingSpaceScale ;
10- left : SpacingSpaceScale ;
11- right : SpacingSpaceScale ;
12- top : SpacingSpaceScale ;
13- }
14-
158export interface BleedProps {
169 /** Elements to display inside tile */
1710 children : React . ReactNode ;
11+ /** Negative space around the element */
1812 spacing ?: SpacingSpaceScale ;
13+ /** Negative horizontal space around the element */
1914 horizontal ?: SpacingSpaceScale ;
15+ /** Negative vertical space around the element */
2016 vertical ?: SpacingSpaceScale ;
17+ /** Negative top space around the element */
2118 top ?: SpacingSpaceScale ;
19+ /** Negative bottom space around the element */
2220 bottom ?: SpacingSpaceScale ;
21+ /** Negative left space around the element */
2322 left ?: SpacingSpaceScale ;
23+ /** Negative right space around the element */
2424 right ?: SpacingSpaceScale ;
2525}
2626
@@ -58,26 +58,24 @@ export const Bleed = ({
5858 }
5959 } ;
6060
61- const negativeMargins = {
62- top : getNegativeMargins ( 'top' ) ,
63- left : getNegativeMargins ( 'left' ) ,
64- right : getNegativeMargins ( 'right' ) ,
65- bottom : getNegativeMargins ( 'bottom' ) ,
66- } as Spacing ;
61+ const negativeTop = getNegativeMargins ( 'top' ) ;
62+ const negativeLeft = getNegativeMargins ( 'left' ) ;
63+ const negativeRight = getNegativeMargins ( 'right' ) ;
64+ const negativeBottom = getNegativeMargins ( 'bottom' ) ;
6765
6866 const style = {
69- ... ( negativeMargins . bottom
70- ? { '--pc-bleed-margin-bottom' : `var(--p-space-${ negativeMargins . bottom } )` }
71- : undefined ) ,
72- ... ( negativeMargins . left
73- ? { '--pc-bleed-margin-left' : `var(--p-space-${ negativeMargins . left } )` }
74- : undefined ) ,
75- ... ( negativeMargins . right
76- ? { '--pc-bleed-margin-right' : `var(--p-space-${ negativeMargins . right } )` }
77- : undefined ) ,
78- ... ( negativeMargins . top
79- ? { '--pc-bleed-margin-top' : `var(--p-space-${ negativeMargins . top } )` }
80- : undefined ) ,
67+ '--pc-bleed-margin- bottom' : negativeBottom
68+ ? `var(--p-space-${ negativeBottom } )`
69+ : undefined ,
70+ '--pc-bleed-margin- left' : negativeLeft
71+ ? `var(--p-space-${ negativeLeft } )`
72+ : undefined ,
73+ '--pc-bleed-margin- right' : negativeRight
74+ ? `var(--p-space-${ negativeRight } )`
75+ : undefined ,
76+ '--pc-bleed-margin- top' : negativeTop
77+ ? `var(--p-space-${ negativeTop } )`
78+ : undefined ,
8179 } as React . CSSProperties ;
8280
8381 return (
0 commit comments