Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1093-make form header sticky #1103

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
th {
padding: 12px 18px;
border-bottom: solid #dededf 1px;
width: 50%;
//width: 50%;
}

th {
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/pages/approvals/ApprovalDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,11 @@ const ApprovalDetail = ({
loading={loading}
dataSource={selectedTab === "raw-data" ? rawValues : values}
columns={columns}
scroll={{ y: 500 }}
// scroll={{ y: 500 }}
pagination={false}
rowClassName={(record) => (record.edited ? "row-edited" : "row-normal")}
rowClassName={(record) =>
record.edited ? "row-edited" : "row-normal sticky"
}
style={{ borderBottom: "solid 1px #ddd" }}
rowKey="id"
expandable={
Expand All @@ -426,7 +428,7 @@ const ApprovalDetail = ({
<span>Loading..</span>
</Space>
) : (
<>
<div className={`pending-data-outer`}>
{record.data?.map((r, rI) => (
<div className="pending-data-wrapper" key={rI}>
<h3>{r.name}</h3>
Expand All @@ -437,7 +439,7 @@ const ApprovalDetail = ({
(record.newValue || record.newValue === 0) &&
!isEqual(record.newValue, record.value)
? "row-edited"
: "row-normal"
: "row-normal sticky"
}
rowKey="id"
columns={[
Expand Down Expand Up @@ -494,7 +496,7 @@ const ApprovalDetail = ({
>
Save Edits
</Button>
</>
</div>
)}
</div>
);
Expand Down
40 changes: 26 additions & 14 deletions frontend/src/pages/approvals/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
color: $color-default;
vertical-align: top;
}

.sticky {
position: sticky;
top: 0;
left: 0;
z-index: 1;
}
.ant-table-cell:nth-child(2) {
.ant-row {
justify-content: flex-start;
Expand Down Expand Up @@ -174,23 +179,30 @@
background: #fefebe;
}
}
.pending-data-wrapper {
border: solid #e9e9e9 1px;
margin-bottom: 20px;
padding: 1rem;
.ant-table {
thead {
tr {
th {
background-color: #f2f2f3;
font-weight: 500;

.pending-data-outer {
height: 500px;
overflow-y: scroll;

.pending-data-wrapper {
border: solid #e9e9e9 1px;
margin-bottom: 20px;
padding: 1rem;
.ant-table {
thead {
tr {
th {
background-color: #f2f2f3;
font-weight: 500;
}
}
}
}
}
}
.pending-data-wrapper:last-child {
margin-bottom: 0;

.pending-data-wrapper:last-child {
margin-bottom: 0;
}
}
}
}
4 changes: 1 addition & 3 deletions frontend/src/pages/submissions/UploadDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const columnsRawData = [
title: "",
dataIndex: "key",
key: "key",
width: 40,
render: (_, __, a) => {
return a + 1;
},
Expand All @@ -44,7 +43,6 @@ const columnsRawData = [
title: "Upload By",
dataIndex: "created_by",
key: "created_by",
width: 200,
},
Table.EXPAND_COLUMN,
];
Expand Down Expand Up @@ -361,7 +359,7 @@ const UploadDetail = ({ record, setReload }) => {
(record.newValue || record.newValue === 0) &&
!isEqual(record.value, record.newValue)
? "row-edited"
: "row-normal"
: "row-normal sticky"
}
style={{ borderBottom: "solid 1px #ddd" }}
rowKey="id"
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/pages/submissions/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
color: $color-default;
vertical-align: top;
}

.sticky {
position: sticky;
top: 0;
left: 0;
z-index: 1;
}
.ant-table-cell:nth-child(2) {
.ant-row {
justify-content: flex-start;
Expand Down