Skip to content

Commit

Permalink
Add 'order' option to Col
Browse files Browse the repository at this point in the history
  • Loading branch information
toshgoodson committed Oct 4, 2019
1 parent 3d101ed commit 7b86302
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ declare module '@bootstrap-styled/v4' {
push?: number | string;
pull?: number | string;
offset?: number | string;
order?: number | string;
});

export type ColProps = {
Expand Down
2 changes: 2 additions & 0 deletions src/Col/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const columnProps = PropTypes.oneOfType([
push: stringOrNumberProp,
pull: stringOrNumberProp,
offset: stringOrNumberProp,
order: stringOrNumberProp,
}),
]);

Expand Down Expand Up @@ -119,6 +120,7 @@ class ColUnstyled extends React.Component { // eslint-disable-line react/prefer-
[`push${colSizeInterfix}${columnProp.push}`]: columnProp.push,
[`pull${colSizeInterfix}${columnProp.pull}`]: columnProp.pull,
[`offset${colSizeInterfix}${columnProp.offset}`]: columnProp.offset,
[`order${colSizeInterfix}${columnProp.order}`]: columnProp.order,
})), cssModule);
} else {
colClass = getColumnSizeClass(isXs, colWidth, columnProp);
Expand Down
2 changes: 1 addition & 1 deletion src/Col/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Col, Row } from '$PACKAGE_NAME';
</Row>
```

You can use `offset`, `size`, `push`, `pull` modifier on any `Col` component:
You can use `offset`, `order`, `size`, `push`, `pull` modifier on any `Col` component:

```js
import { Col, Row } from '$PACKAGE_NAME';
Expand Down
5 changes: 3 additions & 2 deletions src/Col/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,17 @@ describe('<Col />', () => {
});
expect(renderedComponent.find('div').at(1).hasClass('col-md-auto')).toEqual(true);
});
it('should have a classes .col .col-sm-6 .sm-push-2 .sm-pull-2 .sm-offset-2', () => {
it('should have a classes .col .col-sm-6 .sm-push-2 .sm-pull-2 .sm-offset-1 .sm-order-2', () => {
const renderedComponent = renderComponentUsingTheme({
sm: {
size: 6, push: 2, pull: 2, offset: 1,
size: 6, push: 2, pull: 2, offset: 1, order: 2,
},
});
expect(renderedComponent.find('div').at(1).hasClass('col-sm-6')).toEqual(true);
expect(renderedComponent.find('div').at(1).hasClass('push-sm-2')).toEqual(true);
expect(renderedComponent.find('div').at(1).hasClass('pull-sm-2')).toEqual(true);
expect(renderedComponent.find('div').at(1).hasClass('offset-sm-1')).toEqual(true);
expect(renderedComponent.find('div').at(1).hasClass('order-sm-2')).toEqual(true);
});
it('should have children with a theme', () => {
const renderedComponent = renderComponentUsingTheme({
Expand Down
2 changes: 1 addition & 1 deletion src/Row/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
</Row>
```

You can use `offset`, `size`, `push`, `pull` modifier on any `Col` component:
You can use `offset`, `order`, `size`, `push`, `pull` modifier on any `Col` component:

```js
import { Col, Row } from '$PACKAGE_NAME';
Expand Down

0 comments on commit 7b86302

Please sign in to comment.