@patternfly/react-core 5.0.0-alpha.35 → 5.0.0-alpha.36

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "5.0.0-alpha.35",
3
+ "version": "5.0.0-alpha.36",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -70,5 +70,5 @@
70
70
  "react": "^16.8 || ^17 || ^18",
71
71
  "react-dom": "^16.8 || ^17 || ^18"
72
72
  },
73
- "gitHead": "1138b9fba01a2b0ef0d45b2daf11d0fcf6970ee5"
73
+ "gitHead": "150dae762baafab2bdcdbc8c9860204e9b35d3cc"
74
74
  }
@@ -42,16 +42,15 @@ export const Brand: React.FunctionComponent<BrandProps> = ({
42
42
  style,
43
43
  ...props
44
44
  }: BrandProps) => {
45
+ let responsiveStyles;
45
46
  if (children !== undefined && widths !== undefined) {
46
- style = {
47
- ...style,
47
+ responsiveStyles = {
48
48
  ...setBreakpointCssVars(widths, '--pf-c-brand--Width')
49
49
  };
50
50
  }
51
51
 
52
52
  if (children !== undefined && heights !== undefined) {
53
- style = {
54
- ...style,
53
+ responsiveStyles = {
55
54
  ...setBreakpointCssVars(heights, '--pf-c-brand--Height')
56
55
  };
57
56
  }
@@ -59,12 +58,12 @@ export const Brand: React.FunctionComponent<BrandProps> = ({
59
58
  return (
60
59
  /** the brand component currently contains no styling the 'pf-c-brand' string will be used for the className */
61
60
  children !== undefined ? (
62
- <picture className={css(styles.brand, styles.modifiers.picture, className)} style={style} {...props}>
61
+ <picture className={css(styles.brand, styles.modifiers.picture, className)} style={{...style, ...responsiveStyles}} {...props}>
63
62
  {children}
64
- <img src={src} alt={alt} />
63
+ <img src={src} alt={alt}/>
65
64
  </picture>
66
65
  ) : (
67
- <img {...props} className={css(styles.brand, className)} src={src} alt={alt} />
66
+ <img {...props} className={css(styles.brand, className)} style={style} src={src} alt={alt} />
68
67
  )
69
68
  );
70
69
  };
@@ -17,4 +17,20 @@ describe('Brand', () => {
17
17
  );
18
18
  expect(screen.getByText('test')).toBeInTheDocument();
19
19
  });
20
+
21
+ test('styles get spread when there are children', () => {
22
+ render(
23
+ <Brand alt="brand" data-testid="brand" style={{color: "blue"}}>
24
+ <div>test width</div>
25
+ </Brand>
26
+ );
27
+ expect(screen.getByTestId('brand')).toHaveStyle(`color: blue`);
28
+ });
29
+
30
+ test('styles get spread when there are no children', () => {
31
+ render(
32
+ <Brand alt="brand no children" style={{width: "30px"}} />
33
+ );
34
+ expect(screen.getByAltText('brand no children')).toHaveStyle(`width: 30px`);
35
+ });
20
36
  });