Skip to content

Commit

Permalink
feat(packages): components - flex layout update.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnycrich committed Oct 10, 2024
1 parent c7992e9 commit 825db13
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ var FlexLayout = function FlexLayout(_ref) {
return /*#__PURE__*/jsxRuntime.jsx("div", {
className: flexClass,
children: children.map(function (element, i) {
return /*#__PURE__*/jsxRuntime.jsx("div", {
className: "".concat(i === 0 ? 'w-full lg:w-1/2 lg:basis-1/2 flex-shrink-0' : ''),
return i === 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
className: "w-full lg:w-1/2 lg:basis-1/2 flex-shrink-0",
children: element
}, i) : /*#__PURE__*/jsxRuntime.jsx("div", {
className: "flex-grow",
children: element
}, i);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ var FlexLayout = function FlexLayout(_ref) {
return /*#__PURE__*/jsxRuntime.jsx("div", {
className: flexClass,
children: children.map(function (element, i) {
return /*#__PURE__*/jsxRuntime.jsx("div", {
className: "".concat(i === 0 ? 'w-full lg:w-1/2 lg:basis-1/2 flex-shrink-0' : ''),
return i === 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
className: "w-full lg:w-1/2 lg:basis-1/2 flex-shrink-0",
children: element
}, i) : /*#__PURE__*/jsxRuntime.jsx("div", {
className: "flex-grow",
children: element
}, i);
})
Expand Down
21 changes: 11 additions & 10 deletions packages/components/src/flexLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,17 @@ export const FlexLayout = ({ layout, children }: FlexProps) => {
else if (layout[0] === 1 && layout[1] === 1) {
return (
<div className={flexClass}>
{children.map((element, i) => (
<div
key={i}
className={`${
i === 0 ? 'w-full lg:w-1/2 lg:basis-1/2 flex-shrink-0' : ''
}`}
>
{element}
</div>
))}
{children.map((element, i) => {
return i === 0 ? (
<div key={i} className="w-full lg:w-1/2 lg:basis-1/2 flex-shrink-0">
{element}
</div>
) : (
<div key={i} className="flex-grow">
{element}
</div>
);
})}
</div>
);
} else return <div>{children}</div>;
Expand Down

0 comments on commit 825db13

Please sign in to comment.