Skip to content

Commit 50f2d53

Browse files
authored
Merge pull request #118 from scientist-softserv/fix-default-widths
fix default widths
2 parents e645ecf + 43f4423 commit 50f2d53

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/compounds/Item/Item.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ Item.propTypes = {
105105
titleLink: PropTypes.string,
106106
withButtonLink: PropTypes.bool,
107107
withTitleLink: PropTypes.bool,
108-
width: PropTypes.string,
108+
width: PropTypes.oneOfType([
109+
PropTypes.string, // allows percentages
110+
PropTypes.number, // uses pixels
111+
]),
109112
}
110113

111114
Item.defaultProps = {
@@ -121,7 +124,7 @@ Item.defaultProps = {
121124
titleLink: '',
122125
withButtonLink: false,
123126
withTitleLink: false,
124-
width: '',
127+
width: 'auto',
125128
}
126129

127130
export default Item

src/compounds/Item/ItemLoading.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const CardBodyLoading = ({ withButtonLink }) => (
2525

2626
const ItemLoading = ({ orientation, width, withButtonLink }) => (
2727
orientation === 'horizontal' ? (
28-
<Card style={{ width: `${width}` }} className='h-100 mb-4'>
28+
<Card style={{ width }} className='h-100 mb-4'>
2929
<div className='row g-0 h-100'>
3030
<div className='col-3 bg-secondary' />
3131
<div className='col-9 d-flex align-items-center'>
@@ -51,12 +51,15 @@ CardBodyLoading.defaultProps = {
5151

5252
ItemLoading.propTypes = {
5353
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
54-
width: PropTypes.string,
54+
width: PropTypes.oneOfType([
55+
PropTypes.string, // allows percentages
56+
PropTypes.number, // uses pixels
57+
]),
5558
}
5659

5760
ItemLoading.defaultProps = {
5861
orientation: 'vertical',
59-
width: '',
62+
width: 'auto',
6063
}
6164

6265
export default ItemLoading

0 commit comments

Comments
 (0)