File tree Expand file tree Collapse file tree 6 files changed +24
-12
lines changed
Home/components/Section/components/SectionHero
Layout/components/AppLayout/components/Section/components/SectionHero Expand file tree Collapse file tree 6 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,13 @@ import { SVG } from "./hero.styles";
19
19
export interface HeroProps {
20
20
gridSize ?: number ;
21
21
height ?: number ;
22
+ width ?: number ;
22
23
}
23
24
24
25
export const Hero = ( {
25
26
gridSize = GRID_SIZE ,
26
27
height = gridSize * 3 ,
28
+ width = 0 ,
27
29
} : HeroProps ) : JSX . Element => {
28
30
return (
29
31
< SVG
@@ -46,7 +48,7 @@ export const Hero = ({
46
48
< rect
47
49
fill = { getFillUrl ( elementId ) }
48
50
height = { height }
49
- width = "100%"
51
+ width = { width }
50
52
x = { 0 }
51
53
y = { 0 }
52
54
/>
Original file line number Diff line number Diff line change @@ -17,9 +17,13 @@ import {
17
17
export const SectionHero = ( ) : JSX . Element => {
18
18
return (
19
19
< StyledSection >
20
- { ( height ) : JSX . Element => (
20
+ { ( height , width ) : JSX . Element => (
21
21
< Fragment >
22
- < Hero gridSize = { calculateGridSize ( height ) } height = { height } />
22
+ < Hero
23
+ gridSize = { calculateGridSize ( height ) }
24
+ height = { height }
25
+ width = { width }
26
+ />
23
27
< SectionLayout >
24
28
< Headline >
25
29
< Head >
Original file line number Diff line number Diff line change @@ -2,5 +2,6 @@ import styled from "@emotion/styled";
2
2
3
3
export const SVG = styled . svg `
4
4
position: absolute;
5
+ width: 100vw;
5
6
z-index: -1;
6
7
` ;
Original file line number Diff line number Diff line change @@ -11,19 +11,20 @@ import { SVG } from "./hero.styles";
11
11
export interface HeroProps {
12
12
gridSize ?: number ;
13
13
height ?: number ;
14
+ width ?: number ;
14
15
}
15
16
16
17
export const Hero = ( {
17
18
gridSize = GRID_SIZE ,
18
19
height = gridSize * 1.5 ,
20
+ width = 0 ,
19
21
} : HeroProps ) : JSX . Element => {
20
22
return (
21
23
< SVG
22
24
fill = { FILL . NONE }
23
25
height = { height }
24
26
preserveAspectRatio = "xMinYMin meet"
25
27
viewBox = { getViewBox ( gridSize , height ) }
26
- width = "100%"
27
28
xmlns = "http://www.w3.org/2000/svg"
28
29
>
29
30
< SmokeRect gridSize = { gridSize } />
@@ -36,7 +37,7 @@ export const Hero = ({
36
37
< rect
37
38
fill = { getFillUrl ( elementId ) }
38
39
height = { height }
39
- width = "100%"
40
+ width = { width }
40
41
x = { 0 }
41
42
y = { 0 }
42
43
/>
Original file line number Diff line number Diff line change @@ -27,9 +27,13 @@ export const SectionHero = ({
27
27
} : SectionHeroProps ) : JSX . Element => {
28
28
return (
29
29
< StyledSection >
30
- { ( height ) : JSX . Element => (
30
+ { ( height , width ) : JSX . Element => (
31
31
< Fragment >
32
- < Hero gridSize = { calculateGridSize ( height ) } height = { height } />
32
+ < Hero
33
+ gridSize = { calculateGridSize ( height ) }
34
+ height = { height }
35
+ width = { width }
36
+ />
33
37
< SectionLayout >
34
38
< Headline >
35
39
< Breadcrumbs breadcrumbs = { breadcrumbs } />
Original file line number Diff line number Diff line change 1
1
import {
2
- getBorderBoxSizeHeight ,
2
+ getBorderBoxSize ,
3
3
useResizeObserver ,
4
4
} from "@databiosphere/findable-ui/lib/hooks/useResizeObserver" ;
5
5
import { useRef } from "react" ;
6
6
import { StyledSection } from "./section.styles" ;
7
7
8
8
export interface SectionProps {
9
- children : ( height ?: number ) => JSX . Element ;
9
+ children : ( height ?: number , width ?: number ) => JSX . Element ;
10
10
className ?: string ;
11
11
}
12
12
13
13
export const Section = ( { children, className } : SectionProps ) : JSX . Element => {
14
14
const sectionRef = useRef < HTMLElement > ( null ) ;
15
- const { height } =
16
- useResizeObserver ( sectionRef , getBorderBoxSizeHeight ) || { } ;
15
+ const { height, width } =
16
+ useResizeObserver ( sectionRef , getBorderBoxSize ) || { } ;
17
17
return (
18
18
< StyledSection className = { className } ref = { sectionRef } >
19
- { children ?.( height ) }
19
+ { children ?.( height , width ) }
20
20
</ StyledSection >
21
21
) ;
22
22
} ;
You can’t perform that action at this time.
0 commit comments