Skip to content

Commit

Permalink
feat(FileUploader): update size prop
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Apr 26, 2021
1 parent c473bee commit 0c6da29
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@
}
}

.#{$prefix}--file__selected-file--field {
// V11: Remove --field
.#{$prefix}--file__selected-file--field,
.#{$prefix}--file__selected-file--md {
gap: $carbon--spacing-03 $carbon--spacing-05;
min-height: rem(40px);
}
Expand Down Expand Up @@ -198,7 +200,9 @@
padding: $carbon--spacing-02 0;
}

.#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--field {
// V11: Remove --field
.#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--field,
.#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--md {
padding: $carbon--spacing-03 0;
}

Expand All @@ -212,7 +216,10 @@
padding-top: rem(7px);
}

// V11: Remove --field
.#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--field
.#{$prefix}--form-requirement,
.#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--md
.#{$prefix}--form-requirement {
padding-top: rem(11px);
}
Expand Down
11 changes: 8 additions & 3 deletions packages/react/src/components/FileUploader/FileUploader-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ const buttonKinds = {
'Danger Primary (danger--primary)': 'danger--primary',
'Tertiary (tertiary)': 'tertiary',
};

const sizes = {
Default: 'default',
Field: 'field',
Small: 'small',
'Compat check - Field': 'field',
'Compat check - Small': 'small',
'Compat check - default': 'default',
'Small (sm)': 'sm',
'Medium (md)': 'md',
'Large (lg) - Default': 'lg',
};

const filenameStatuses = {
'Edit (edit)': 'edit',
'Complete (complete)': 'complete',
Expand Down
7 changes: 4 additions & 3 deletions packages/react/src/components/FileUploader/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ export default class FileUploader extends React.Component {
/**
* Specify the size of the FileUploaderButton, from a list of available
* sizes. For `default` buttons, this prop can remain unspecified.
* V11: `default`, `field`, and `small` will be removed
*/
size: PropTypes.oneOf(['default', 'field', 'small']),
size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']),
};

static defaultProps = {
Expand Down Expand Up @@ -179,8 +180,8 @@ export default class FileUploader extends React.Component {
});

const selectedFileClasses = classNames(`${prefix}--file__selected-file`, {
[`${prefix}--file__selected-file--field`]: size === 'field',
[`${prefix}--file__selected-file--sm`]: size === 'small',
[`${prefix}--file__selected-file--md`]: size === 'field' || size === 'md',
[`${prefix}--file__selected-file--sm`]: size === 'small' || size === 'sm',
});

return (
Expand Down
12 changes: 7 additions & 5 deletions packages/react/src/components/FileUploader/FileUploaderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ function FileUploaderButton({
const classes = cx(`${prefix}--btn`, className, {
[`${prefix}--btn--${buttonKind}`]: buttonKind,
[`${prefix}--btn--disabled`]: disabled,
[`${prefix}--btn--field`]: size === 'field',
[`${prefix}--btn--sm`]: size === 'small',
// V11: remove field, small
[`${prefix}--btn--md`]: size === 'field' || size === 'md',
[`${prefix}--btn--sm`]: size === 'small' || size === 'sm',
});

// Adjust label text state based on changes to the labelText prop
Expand Down Expand Up @@ -174,10 +175,11 @@ FileUploaderButton.propTypes = {
role: PropTypes.string,

/**
* Specify the size of the button, from a list of available sizes.
* For `default` buttons, this prop can remain unspecified.
* Specify the size of the FileUploaderButton, from a list of available
* sizes. For `default` buttons, this prop can remain unspecified.
* V11: `default`, `field`, and `small` will be removed
*/
size: PropTypes.oneOf(['default', 'field', 'small']),
size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']),

/**
* Provide a custom tabIndex value for the <FileUploaderButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ FileUploaderDropContainer.propTypes = {

/**
* Specify the size of the uploaded items, from a list of available
* sizes. For `default` size, this prop can remain unspecified.
* sizes. For `default` buttons, this prop can remain unspecified.
* V11: `default`, `field`, and `small` will be removed
*/
size: PropTypes.oneOf(['default', 'field', 'small']),
size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']),

/**
* Provide a custom tabIndex value for the <FileUploaderButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function FileUploaderItem({
const { current: id } = useRef(uuid || uid());
const classes = cx(`${prefix}--file__selected-file`, {
[`${prefix}--file__selected-file--invalid`]: invalid,
[`${prefix}--file__selected-file--field`]: size === 'field',
[`${prefix}--file__selected-file--sm`]: size === 'small',
[`${prefix}--file__selected-file--md`]: size === 'field' || size === 'md',
[`${prefix}--file__selected-file--sm`]: size === 'small' || size === 'sm',
});
return (
<span className={classes} {...other}>
Expand Down Expand Up @@ -107,9 +107,10 @@ FileUploaderItem.propTypes = {

/**
* Specify the size of the uploaded items, from a list of available
* sizes. For `default` size, this prop can remain unspecified.
* sizes. For `default` buttons, this prop can remain unspecified.
* V11: `default`, `field`, and `small` will be removed
*/
size: PropTypes.oneOf(['default', 'field', 'small']),
size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']),

/**
* Status of the file upload
Expand Down

0 comments on commit 0c6da29

Please sign in to comment.