Skip to content
This repository was archived by the owner on Jul 17, 2023. It is now read-only.

Commit 754e614

Browse files
github-actions[bot]Nathan Young
and
Nathan Young
authored
fix(Block): Block maxWidth causes propType warning when passing "none" even though it's a valid value
* fix #310 * Update index.js Co-authored-by: Nathan Young <[email protected]>
1 parent c8ce7ad commit 754e614

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Components/Block/Block.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
colorType,
1616
dimensionType,
1717
itemSpacingType,
18+
maxDimensionType,
1819
orderType,
1920
overflowType,
2021
radiusType,
@@ -259,7 +260,7 @@ const propTypes = {
259260
*
260261
* For responsive behavior, pass an array with length up to 4, with a valid value for each element.
261262
*/
262-
maxWidth: dimensionType,
263+
maxWidth: maxDimensionType,
263264
/**
264265
* Controls the order in which the item appears in a flex container
265266
*

src/Types/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ export { default as orderType } from './OrderType';
99
export { default as radiusType } from './RadiusType';
1010
export { default as spacingType } from './SpacingType';
1111
export { default as textSizeType } from './TextSizeType';
12-
export {
13-
default as boolRequiresOtherProp,
14-
} from './BoolRequiresOtherProp';
12+
export { default as boolRequiresOtherProp } from './BoolRequiresOtherProp';
1513
export { default as requiresOtherProp } from './RequiresOtherProp';
1614

1715
export const colorType = PropTypes.oneOf([
@@ -150,12 +148,20 @@ const validDimensions = [
150148
'100',
151149
];
152150

151+
const validMaxDimensions = ['none', ...validDimensions];
152+
153153
export const dimensionType = PropTypes.oneOfType([
154154
PropTypes.oneOf(validDimensions),
155155
PropTypes.string,
156156
PropTypes.arrayOf(PropTypes.oneOf(validDimensions)),
157157
]);
158158

159+
export const maxDimensionType = PropTypes.oneOfType([
160+
PropTypes.oneOf(validMaxDimensions),
161+
PropTypes.string,
162+
PropTypes.arrayOf(PropTypes.oneOf(validMaxDimensions)),
163+
]);
164+
159165
export const placementType = PropTypes.oneOf([
160166
'auto',
161167
'auto-start',

0 commit comments

Comments
 (0)