Skip to content

Commit

Permalink
Merge pull request #278 from qoretechnologies/bugfix/fix-collection-c…
Browse files Browse the repository at this point in the history
…olumns-props

Fixed a regression bug where columns props were not properly passed to `ReqoreColumns` inside the collection
  • Loading branch information
Foxhoundn authored Feb 18, 2023
2 parents 5bb32b3 + 5f48d71 commit f5f2191
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qoretechnologies/reqore",
"version": "0.34.1",
"version": "0.34.2",
"description": "ReQore is a highly theme-able and modular UI library for React",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
15 changes: 13 additions & 2 deletions src/components/Collection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const StyledCollectionWrapper = styled(StyledColumns)`

export const ReqoreCollection = ({
items,
columnsGap = '10px',
stacked,
rounded = true,
fill,
Expand Down Expand Up @@ -100,6 +99,14 @@ export const ReqoreCollection = ({
inputPlaceholder = (items) => `Search in ${size(items)} items`,
paging,
height,

// Columns props
minColumnWidth,
maxColumnWidth,
columns,
alignItems,
columnsGap = '10px',

...rest
}: IReqoreCollectionProps) => {
const [_showAs, setShowAs] = useState<'list' | 'grid'>(showAs);
Expand Down Expand Up @@ -251,13 +258,17 @@ export const ReqoreCollection = ({
</ReqoreMessage>
) : (
<StyledCollectionWrapper
columns={_showAs === 'grid' ? 'auto-fit' : 1}
columns={columns || (_showAs === 'grid' ? 'auto-fit' : 1)}
columnsGap={stacked ? '0px' : columnsGap}
rounded={rounded}
stacked={stacked}
fill={fill}
ref={setContentRef}
height={height}
alignItems={alignItems}
minColumnWidth={minColumnWidth}
maxColumnWidth={maxColumnWidth}
className='reqore-collection-content'
>
{finalItems?.map((item, index) => (
<ReqoreCollectionItem
Expand Down
10 changes: 10 additions & 0 deletions src/stories/Collection/Collection.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ SelectedFirst.args = {
showSelectedFirst: true,
};

export const CustomColumnsData = Template.bind({});
CustomColumnsData.args = {
columns: 2,
columnsGap: '50px',
minColumnWidth: '100px',
maxColumnWidth: '200px',
items,
label: '2 columns of max 200px width with 50px gap',
};

export const CustomPropsAndTexts = Template.bind({});
CustomPropsAndTexts.args = {
label: 'Collection of items',
Expand Down

0 comments on commit f5f2191

Please sign in to comment.