Skip to content

Commit

Permalink
Make card mode automatic.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Aug 4, 2024
1 parent ee76c6e commit d039c16
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 1 addition & 7 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
"stylelint-config-prettier"
],
"rules": {
"no-descending-specificity": null,
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global", "horizontal", "vertical"]
}
]
"no-descending-specificity": null
},
"ignoreFiles": ["**/*.js"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-basics",
"version": "0.123.0",
"version": "0.124.0",
"description": "Everyday components for React",
"license": "MIT",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion src/components/table/GridTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import classNames from 'classnames';
import { CommonProps } from 'components/types';
import { mapChildren } from 'components/utils';
import { useBreakpoint } from 'components/hooks/useBreakpoint';
// eslint-disable-next-line css-modules/no-unused-class
import styles from './GridTable.module.css';

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

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

if (cardMode) {
if (cardMode || responsive) {
return (
<div className={classNames(styles.cards, className)}>
{data.map((row, index) => (
Expand Down

0 comments on commit d039c16

Please sign in to comment.