Skip to content

Commit d039c16

Browse files
committed
Make card mode automatic.
1 parent ee76c6e commit d039c16

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

.stylelintrc.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
"stylelint-config-prettier"
66
],
77
"rules": {
8-
"no-descending-specificity": null,
9-
"selector-pseudo-class-no-unknown": [
10-
true,
11-
{
12-
"ignorePseudoClasses": ["global", "horizontal", "vertical"]
13-
}
14-
]
8+
"no-descending-specificity": null
159
},
1610
"ignoreFiles": ["**/*.js"]
1711
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-basics",
3-
"version": "0.123.0",
3+
"version": "0.124.0",
44
"description": "Everyday components for React",
55
"license": "MIT",
66
"repository": {

src/components/table/GridTable.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import { CommonProps } from 'components/types';
33
import { mapChildren } from 'components/utils';
4+
import { useBreakpoint } from 'components/hooks/useBreakpoint';
45
// eslint-disable-next-line css-modules/no-unused-class
56
import styles from './GridTable.module.css';
67

@@ -13,8 +14,10 @@ export interface GridTableProps extends CommonProps {
1314

1415
export function GridTable(props: GridTableProps) {
1516
const { data, className, style, children, cardMode, ...domProps } = props;
17+
const breakpoint = useBreakpoint();
18+
const responsive = ['xs', 'sm', 'md'].includes(breakpoint);
1619

17-
if (cardMode) {
20+
if (cardMode || responsive) {
1821
return (
1922
<div className={classNames(styles.cards, className)}>
2023
{data.map((row, index) => (

0 commit comments

Comments
 (0)