Skip to content

Commit

Permalink
🔥 Fix Grid responsive issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
anitnilay20 committed Jan 28, 2021
1 parent 7f65132 commit 162d78e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/Grid/Col.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Col: React.FC<ColProps> = React.forwardRef((props, ref) => {
...rest
} = props;
return (
<div ref={ref} className={classes(className, colStyle(props).col, 'sha-el-col')} {...rest}>
<div ref={ref} className={classes(className, colStyle()(props).col, 'sha-el-col')} {...rest}>
{children}
</div>
);
Expand Down
11 changes: 5 additions & 6 deletions src/components/Grid/style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createUseStyles } from 'react-jss';

export const colStyle = createUseStyles(
{
export const colStyle = () => {
const styles = {
col: (props) => ({
maxWidth: !props.flex && 100 / (24 / props.span) + '%',
flexBasis: !props.flex && 100 / (24 / props.span) + '%',
Expand All @@ -17,7 +17,6 @@ export const colStyle = createUseStyles(
marginLeft: props.offset && typeof props.offset === 'object' && 100 / (24 / props.offset.xs) + '%',
}),
},

'@media (min-width: 576px)': {
col: (props) => ({
maxWidth: !props.flex && 100 / (24 / props.spanSm) + '%',
Expand Down Expand Up @@ -49,9 +48,9 @@ export const colStyle = createUseStyles(
marginLeft: props.offset && typeof props.offset === 'object' && 100 / (24 / props.offset.xl) + '%',
}),
},
},
{ name: 'sha-el-col' },
);
};
return createUseStyles(styles, { name: 'sha-el-col' });
};

export const rowStyle = createUseStyles(
{
Expand Down

0 comments on commit 162d78e

Please sign in to comment.