playbook_ui 14.17.0.pre.alpha.alphaforaudiences7167 → 14.17.0.pre.alpha.play1499backgroundkitoverlay7105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d4e1505953fc9d8679af10f4517e1db1910b806f2540bcba412afbaca8eb912
4
- data.tar.gz: e1ec597e443b273d2037e5e0a572a9ca8f52ce25fb3754ccbc24edebd969377b
3
+ metadata.gz: b38daf6aad351a9d3b57169619dbba3749175bb2e2aae4f92aeb1368d8cd6cd5
4
+ data.tar.gz: 6718570cbc87905c88c57df0f1878cabd011e6ddac73d4c522c9ed88f08e537a
5
5
  SHA512:
6
- metadata.gz: c5e5f58405349fa05f6942b377efee9d7c845c74dfbbe1009fe28e9c50459871f1dcc0e23f9a4bc2e190493ef648fce14e3b06bd0e697fa8a07114c95068c219
7
- data.tar.gz: 84723e76ae32724c3926bf9ac0a7b9b048ae640635f982ca9126ae99fdbd97528215d7c7dd563e739d9a3718787a98f31ce31729a725080466de72ffb50cbf61
6
+ metadata.gz: 8f1df4e4bcd4f2f0dac7285d99a80bd63c0b139db5256d2c8fe7754f78a573a811fa17fd3d8203eff2de08c576070c862add9cf92a3869a63bc178e87abd3a98
7
+ data.tar.gz: 2a0df11f026f0afe56e42a873105cd71756ea23d7e6bedec727954db2ff20fe7781142226f2415fe1f5d21d38a4c4e1c8fe286bf4a888e2d1f8089a7ba9ac2c7
@@ -55,4 +55,30 @@ $background_colors: map-merge($additional_colors, $merge_kits7);
55
55
  transition: 700ms ease-in;
56
56
  }
57
57
  }
58
+
59
+ &.imageoverlay {
60
+ position: relative;
61
+
62
+ &:before {
63
+ content: "";
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ right: 0;
68
+ bottom: 0;
69
+ z-index: 1;
70
+ background-color: inherit;
71
+ }
72
+
73
+ * {
74
+ position: relative;
75
+ z-index: 2;
76
+ }
77
+ }
78
+
79
+ @each $key, $value in $opacity {
80
+ &.imageoverlay[imageoverlay="#{$key}"]::before {
81
+ opacity: $value;
82
+ }
83
+ }
58
84
  }
@@ -25,6 +25,7 @@ type BackgroundProps = {
25
25
  backgroundPosition?: ResponsiveProp<string> | string,
26
26
  backgroundRepeat?: ResponsiveProp<BackgroundRepeat> | BackgroundRepeat,
27
27
  imageUrl?: ResponsiveProp<string> | string,
28
+ imageOverlay?: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
28
29
  children?: React.ReactChild[] | React.ReactNode,
29
30
  className?: string,
30
31
  customColor?: string,
@@ -86,8 +87,9 @@ const Background = (props: BackgroundProps): React.ReactElement => {
86
87
  imageUrl = '',
87
88
  tag = 'div',
88
89
  transition = '',
90
+ imageOverlay,
89
91
  } = props
90
-
92
+
91
93
  const [responsiveProps, setResponsiveProps] = useState({
92
94
  backgroundSize: getResponsiveValue(backgroundSize),
93
95
  backgroundPosition: getResponsiveValue(backgroundPosition),
@@ -132,7 +134,8 @@ const Background = (props: BackgroundProps): React.ReactElement => {
132
134
  [`pb_background_color_${resBackgroundColor}`]: resBackgroundColor && !customColor,
133
135
  [`pb_background_custom_color`]: !!customColor,
134
136
  },
135
- className
137
+ className,
138
+ imageOverlay ? "imageoverlay" : ""
136
139
  );
137
140
 
138
141
  const backgroundStyle = {
@@ -155,7 +158,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
155
158
  const ariaProps = buildAriaProps(aria);
156
159
  const dataProps = buildDataProps(data);
157
160
  const htmlProps = buildHtmlProps(htmlOptions);
158
-
161
+
159
162
  return (
160
163
  <Tag
161
164
  {...ariaProps}
@@ -164,11 +167,12 @@ const Background = (props: BackgroundProps): React.ReactElement => {
164
167
  alt={alt}
165
168
  className={classes}
166
169
  id={id}
170
+ imageOverlay={imageOverlay}
167
171
  style={combinedStyles}
168
172
  >
169
173
  {children}
170
174
  </Tag>
171
-
175
+
172
176
  )
173
177
  }
174
178
 
@@ -0,0 +1,36 @@
1
+ import React from 'react'
2
+ import Background from "../../pb_background/_background"
3
+ import Flex from "../../pb_flex/_flex"
4
+ import FlexItem from "../../pb_flex/_flex_item"
5
+ import Title from "../../pb_title/_title"
6
+
7
+ const BackgroundOverlay = (props) => {
8
+ return (
9
+ <Background
10
+ alt="colorful background"
11
+ className="background lazyload"
12
+ imageOverlay="opacity_6"
13
+ imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
14
+ {...props}
15
+ backgroundColor="light"
16
+ >
17
+ <Flex
18
+ orientation="column"
19
+ vertical="center"
20
+ {...props}
21
+ >
22
+ <FlexItem>
23
+ <Title
24
+ dark
25
+ padding="lg"
26
+ size={1}
27
+ text="Background Kit Image"
28
+ {...props}
29
+ />
30
+ </FlexItem>
31
+ </Flex>
32
+ </Background>
33
+ )
34
+ }
35
+
36
+ export default BackgroundOverlay
@@ -0,0 +1 @@
1
+ An overlay can be added to the background image by setting the `imageOverlay` prop and adding a `backgroundColor`. The `imageOverlay` prop can be set to any opacity ranging from `opacity_1` to `opacity_10`.
@@ -11,6 +11,7 @@ examples:
11
11
  - background_size: Size
12
12
 
13
13
  react:
14
+ - background_overlay: Overlay
14
15
  - background_light: Light
15
16
  - background_white: White
16
17
  - background_gradient: Gradient
@@ -6,3 +6,4 @@ export { default as BackgroundStatus } from './_background_status.jsx'
6
6
  export { default as BackgroundStatusSubtle } from './_background_status_subtle.jsx'
7
7
  export { default as BackgroundCategory } from './_background_category.jsx'
8
8
  export { default as BackgroundSize } from './_background_size.jsx'
9
+ export { default as BackgroundOverlay } from './_background_overlay.jsx'