Skip to content

Commit

Permalink
Revert "feat: conditional rendering title in TableRow component"
Browse files Browse the repository at this point in the history
This reverts commit 152aa43.
  • Loading branch information
iacopolea committed Aug 7, 2024
1 parent 152aa43 commit 63ee7cd
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/stories/table/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface CellProps {
const Cell = ({ data, col }: CellProps) => {
useWindowSize();
const isDesktop = window.matchMedia(
`only screen and (min-width: ${aqBootstrapTheme.grid.breakpoints.lg})`,
`only screen and (min-width: ${aqBootstrapTheme.grid.breakpoints.lg})`
).matches;
const content =
typeof data === "object" && "content" in data
Expand All @@ -43,11 +43,7 @@ const Cell = ({ data, col }: CellProps) => {
<div>{content}</div>
) : (
<>
{!!col.title && (
<>
<span className="data-index">{col.title}</span>:{" "}
</>
)}
<span className="data-index">{col.title}</span>:{" "}
<strong>{content}</strong>
</>
)}
Expand All @@ -74,7 +70,7 @@ const Element = styled.div<ElementProps>`
: `max-height: max-content;
height: 100%;
`}
}
} ;
`;

const CardStyle = styled.div`
Expand Down Expand Up @@ -210,7 +206,7 @@ export const TableRow = ({
>
<Cell data={dataRow[col.dataIndex]} col={col} />
</Element>
),
)
)}
<Element role="more" className="more-info" isCompact={isCompact}>
{columns.map(
Expand All @@ -221,7 +217,7 @@ export const TableRow = ({
data={dataRow[col.dataIndex]}
col={col}
/>
),
)
)}
</Element>
</CardStyle>
Expand All @@ -247,7 +243,7 @@ export const TableRow = ({
>
<Cell data={dataRow[col.dataIndex]} col={col} />
</ElementAlternative>
),
)
)}
<ElementsContainer>
{columns.map(
Expand All @@ -256,7 +252,7 @@ export const TableRow = ({
<div key={`${dataRow.key}-${col.key}`}>
{dataRow[col.dataIndex] as React.ReactNode}
</div>
),
)
)}
</ElementsContainer>
{columns.map(
Expand All @@ -265,14 +261,14 @@ export const TableRow = ({
<ElementAlternative key={`${dataRow.key}-${col.key}`}>
<Cell data={dataRow[col.dataIndex]} col={col} />
</ElementAlternative>
),
)
)}
</CardAlternativeStyle>
);
};

return window.matchMedia(
`only screen and (min-width: ${aqBootstrapTheme.grid.breakpoints.lg})`,
`only screen and (min-width: ${aqBootstrapTheme.grid.breakpoints.lg})`
).matches ? (
<BasicRow />
) : !mobileAlternative ? (
Expand Down

0 comments on commit 63ee7cd

Please sign in to comment.