Skip to content

Commit

Permalink
refactor: adjust expandable row styles
Browse files Browse the repository at this point in the history
  • Loading branch information
ismay committed Nov 14, 2023
1 parent def6c57 commit 2ae80b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
19 changes: 5 additions & 14 deletions src/components/JobTable/ExpandableRow.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import React from 'react'
import { TableRow, TableCell } from '@dhis2/ui'
import PropTypes from 'prop-types'
import cx from 'classnames'
import { jobTypesMap } from '../../services/server-translations'
import styles from './ExpandableRow.module.css'

const ExpandableRow = ({ job, isFirst, isLast }) => {
const ExpandableRow = ({ job }) => {
return (
<TableRow
className={cx(styles.row, {
[styles.first]: isFirst,
[styles.last]: isLast,
})}
suppressZebraStriping
>
<TableCell className={styles.cell} />
<TableCell className={styles.cell}>{job.name}</TableCell>
<TableCell className={styles.cell} colSpan="6">
<TableRow className={styles.row} suppressZebraStriping>
<TableCell />
<TableCell className={styles.indent}>{job.name}</TableCell>
<TableCell className={styles.indent} colSpan="6">
{jobTypesMap[job.type]}
</TableCell>
</TableRow>
Expand All @@ -26,8 +19,6 @@ const ExpandableRow = ({ job, isFirst, isLast }) => {
const { shape, string } = PropTypes

ExpandableRow.propTypes = {
isFirst: string.isRequired,
isLast: string.isRequired,
job: shape({
name: string.isRequired,
type: string.isRequired,
Expand Down
11 changes: 3 additions & 8 deletions src/components/JobTable/ExpandableRow.module.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
.row {
background: var(--colors-grey300);
box-shadow: inset 8px 0 0 0 var(--colors-grey500);
}

.first {
box-shadow: inset 0 5px 4px -4px var(--colors-grey600);
}

.last .cell {
/* Using important here to override the specificity of styled-jsx's inline styles */
.indent {
/* stylelint-disable-next-line declaration-no-important */
border-bottom: 1px solid var(--colors-grey300) !important;
padding-left: 32px !important;
}
9 changes: 2 additions & 7 deletions src/components/JobTable/QueueTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@ const QueueTableRow = ({
</TableCell>
</TableRow>
{showJobs
? sequence.map((job, index) => (
<ExpandableRow
key={job.id}
job={job}
isFirst={index === 0}
isLast={index === sequence.length - 1}
/>
? sequence.map((job) => (
<ExpandableRow key={job.id} job={job} />
))
: null}
</>
Expand Down

0 comments on commit 2ae80b9

Please sign in to comment.