Skip to content

Commit

Permalink
Adds a view wrapper with a style of 100vh so that what space is also …
Browse files Browse the repository at this point in the history
…clickable
  • Loading branch information
eireland committed Sep 27, 2023
1 parent d51d3fa commit 72cd280
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/components/app.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.selectView {
padding: 10px;

height: 100vh;

.buttons {
display: flex;
gap: 5px;
}
}
}
6 changes: 5 additions & 1 deletion src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ function App() {
);

default:
return renderSelectView();
return (
<div onClick={handleShowComponent}>
{renderSelectView()}
</div>
);
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/components/flat-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ interface IFlatProps extends ITableProps {
}

export const FlatTable = (props: IFlatProps) => {
const {selectedDataSet, collections, collectionClasses, items, mapCellsFromValues, showHeaders,
handleShowComponent} = props;
const {selectedDataSet, collections, collectionClasses, items, mapCellsFromValues, showHeaders} = props;
const collection = collections[0];
const {className} = collectionClasses[0];

return (
<table className={`${css.mainTable} ${css.flatTable} ${css[className]}}`} onClick={handleShowComponent}>
<table className={`${css.mainTable} ${css.flatTable} ${css[className]}}`}>
<tbody>
<tr className={css.mainHeader}>
<th colSpan={items.length}>{selectedDataSet.title}</th>
Expand Down
4 changes: 4 additions & 0 deletions src/components/hierarchy-view/hierarchy.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.hierarchyWrapper {
height: 100vh;
}

.hierarchy {
display: flex;
flex-direction: row;
Expand Down
2 changes: 1 addition & 1 deletion src/components/hierarchy-view/hierarchy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Hierarchy = (props: IProps) => {
};

return (
<div onClick={handleShowComponent}>
<div className={css.hierarchyWrapper} onClick={handleShowComponent}>
<div className={css.hierarchy} style={{gap: CollectionGap}}>
<DndContext
collisionDetection={closestCorners}
Expand Down
4 changes: 2 additions & 2 deletions src/components/landscape-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import css from "./tables.scss";

export const LandscapeView = (props: ITableProps) => {
const {mapCellsFromValues, mapHeadersFromValues, showHeaders, collectionClasses,
getClassName, selectedDataSet, collections, getValueLength, paddingStyle, handleShowComponent} = props;
getClassName, selectedDataSet, collections, getValueLength, paddingStyle} = props;

const renderNestedTable = (parentColl: ICollection) => {
const firstRowValues = parentColl.cases.map(caseObj => caseObj.values);
Expand Down Expand Up @@ -95,7 +95,7 @@ export const LandscapeView = (props: ITableProps) => {
};

return (
<div onClick={handleShowComponent}>
<div>
{collections.length && collectionClasses.length && renderTable()}
</div>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/nested-table.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.nestedTableWrapper {
height: 100vh;
}
6 changes: 4 additions & 2 deletions src/components/nested-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Menu } from "./menu";
import { LandscapeView } from "./landscape-view";
import { FlatTable } from "./flat-table";

import css from "./nested-table.scss";

const portrait = "Portrait";
const landscape = "Landscape";
const none = "";
Expand Down Expand Up @@ -112,7 +114,7 @@ export const NestedTable = (props: IProps) => {
const isNoHierarchy = collections.length === 1;
const classesExist = collectionClasses.length > 0;
const tableProps = {showHeaders: interactiveState.showHeaders, collectionClasses, collections, selectedDataSet,
getClassName, mapHeadersFromValues, mapCellsFromValues, getValueLength, paddingStyle, handleShowComponent};
getClassName, mapHeadersFromValues, mapCellsFromValues, getValueLength, paddingStyle};
const flatProps = {...tableProps, items};
if (isNoHierarchy && classesExist) {
return <FlatTable {...flatProps}/>;
Expand All @@ -128,7 +130,7 @@ export const NestedTable = (props: IProps) => {
};

return (
<div>
<div className={css.nestedTableWrapper} onClick={handleShowComponent}>
<Menu
dataSets={dataSets}
collections={collections}
Expand Down
4 changes: 2 additions & 2 deletions src/components/portrait-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import css from "./tables.scss";

export const PortraitView = (props: ITableProps) => {
const {paddingStyle, mapCellsFromValues, mapHeadersFromValues, showHeaders, collectionClasses,
getClassName, selectedDataSet, collections, getValueLength, handleShowComponent} = props;
getClassName, selectedDataSet, collections, getValueLength} = props;

const renderNestedTable = (parentColl: ICollection) => {
const firstRowValues = parentColl.cases.map(caseObj => caseObj.values);
Expand Down Expand Up @@ -80,7 +80,7 @@ export const PortraitView = (props: ITableProps) => {
};

return (
<div onClick={handleShowComponent}>
<div>
{collections.length && collectionClasses.length && renderTable()}
</div>
);
Expand Down
1 change: 0 additions & 1 deletion src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export interface ITableProps {
mapHeadersFromValues: (values: IValues) => void,
getValueLength: (firstRow: Array<IValues>) => number
paddingStyle: Record<string, string>
handleShowComponent: () => void
}

export interface IBoundingBox {
Expand Down

0 comments on commit 72cd280

Please sign in to comment.