Skip to content

Commit

Permalink
Made lists responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
ianvexler committed Feb 19, 2024
1 parent aba0dc5 commit 3ddc717
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/components/list/List.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
interface ListProps extends React.HTMLProps<HTMLDivElement> {
}
declare const List: {
({ children, ...rest }: ListProps): React.JSX.Element;
({ className, children, ...rest }: ListProps): React.JSX.Element;
Head: ({ className, children, ...rest }: import("./components/ListHead").ListHeadProps) => React.JSX.Element;
Cell: ({ borderStart, className, children, background, ...rest }: import("./components/ListCell").ListCellProps) => React.JSX.Element;
Row: ({ children, ...rest }: import("./components/ListRow").ListRowProps) => React.JSX.Element;
Expand Down
2 changes: 1 addition & 1 deletion dist/components/list/List.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions dist/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,11 @@ a.breadcrumb-item:hover {
text-decoration: underline;
}

.list-container {
overflow-x: auto;
white-space: nowrap;
}

:root {
--texmo-primary-color: #6A955B;
--texmo-text-color: #424244;
Expand Down
5 changes: 5 additions & 0 deletions dist/index.es.css
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,11 @@ a.breadcrumb-item:hover {
text-decoration: underline;
}

.list-container {
overflow-x: auto;
white-space: nowrap;
}

:root {
--texmo-primary-color: #6A955B;
--texmo-text-color: #424244;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.es.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22888,13 +22888,13 @@ var ListSectionContext = React.createContext(ListSection.NONE);
var ListHead = function (_a) {
var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
return (React.createElement(ListSectionContext.Provider, { value: ListSection.HEAD },
React.createElement("div", __assign$1({ className: "".concat(className, " mx-0 row card-header text-center") }, rest), children)));
React.createElement("div", __assign$1({ className: "".concat(className, " mx-0 row card-header text-center list-row") }, rest), children)));
};

var ListRow = function (_a) {
var children = _a.children, rest = __rest(_a, ["children"]);
var childrenArray = React.Children.toArray(children);
return (React.createElement(Row$1, __assign$1({ className: "text-center mt-3 mx-0" }, rest), childrenArray.map(function (child, index) {
return (React.createElement(Row$1, __assign$1({ className: "text-center mt-3 mx-0 list-row" }, rest), childrenArray.map(function (child, index) {
var childElement = child;
return React.cloneElement(childElement, {
borderStart: index !== 0,
Expand All @@ -22908,11 +22908,11 @@ var ListCell = function (_a) {
var border = borderStart ? 'border-start' : undefined;
switch (section) {
case ListSection.HEAD:
return (React.createElement("div", __assign$1({ className: "col ".concat(className) }, rest), children));
return (React.createElement("div", __assign$1({ className: "col list-cell ".concat(className) }, rest), children));
case ListSection.BODY:
case ListSection.NONE:
default:
return (React.createElement("div", __assign$1({ className: "h-100 d-flex align-items-center ".concat(className) }, rest),
return (React.createElement("div", __assign$1({ className: "h-100 d-flex align-items-center list-cell ".concat(className) }, rest),
React.createElement(Card$2, { className: "h-100 w-100 py-3", style: { backgroundColor: background } },
React.createElement(Card$2.Body, { className: "d-flex justify-content-center align-items-center py-0 ".concat(border) },
React.createElement("div", { className: "w-100" }, children)))));
Expand All @@ -22931,8 +22931,8 @@ var ListBody = function (_a) {
};

var List = function (_a) {
var children = _a.children, rest = __rest(_a, ["children"]);
return React.createElement("div", __assign$1({}, rest), children);
var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
return (React.createElement("div", __assign$1({ className: "list-container ".concat(className) }, rest), children));
};
List.Head = ListHead;
List.Cell = ListCell;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions dist/index.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,11 @@ a.breadcrumb-item:hover {
text-decoration: underline;
}

.list-container {
overflow-x: auto;
white-space: nowrap;
}

:root {
--texmo-primary-color: #6A955B;
--texmo-text-color: #424244;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scss/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ a.breadcrumb-item {

a.breadcrumb-item:hover {
text-decoration: underline;
}
}
1 change: 1 addition & 0 deletions scss/texmo-react-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
@import '../src/components/button/Button.scss';
@import '../src/components/title/Title.scss';
@import '../src/components/card/Card.scss';
@import '../src/components/list/List.scss';
13 changes: 13 additions & 0 deletions src/components/list/List.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.list-container {
overflow-x: auto;
white-space: nowrap;
}

.list-row {
display: flex !important;
flex-wrap: nowrap !important;
}

.list-cell {
min-width: 150px;
}
8 changes: 6 additions & 2 deletions src/components/list/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import ListBody from './components/ListBody';

interface ListProps extends React.HTMLProps<HTMLDivElement> {}

const List = ({ children, ...rest }: ListProps) => {
return <div {...rest}>{children}</div>;
const List = ({ className, children, ...rest }: ListProps) => {
return (
<div className={`list-container ${className}`} {...rest}>
{children}
</div>
);
};

List.Head = ListHead;
Expand Down
4 changes: 2 additions & 2 deletions src/components/list/components/ListCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ListCell = ({
switch (section) {
case ListSection.HEAD:
return (
<div className={`col ${className}`} {...rest}>
<div className={`col list-cell ${className}`} {...rest}>
{children}
</div>
);
Expand All @@ -29,7 +29,7 @@ const ListCell = ({
default:
return (
<div
className={`h-100 d-flex align-items-center ${className}`}
className={`h-100 d-flex align-items-center list-cell ${className}`}
{...rest}
>
<Card
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/components/ListHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ListHead = ({ className, children, ...rest }: ListHeadProps) => {
return (
<ListSectionContext.Provider value={ListSection.HEAD}>
<div
className={`${className} mx-0 row card-header text-center`}
className={`${className} mx-0 row card-header text-center list-row`}
{...rest}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/components/ListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ListRow = ({ children, ...rest }: ListRowProps) => {
const childrenArray = React.Children.toArray(children);

return (
<Row className="text-center mt-3 mx-0" {...rest}>
<Row className="text-center mt-3 mx-0 list-row" {...rest}>
{childrenArray.map((child, index) => {
const childElement = child as React.ReactElement;

Expand Down

0 comments on commit 3ddc717

Please sign in to comment.