Skip to content

Commit

Permalink
fix: styling fixes for List items
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Nov 21, 2024
1 parent b5793b6 commit fd265f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Item/ListItem/Item.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useConfig } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { Divider, IconFileDocument16, colors, spacers } from '@dhis2/ui'
import cx from 'classnames'
import PropTypes from 'prop-types'
import React from 'react'
import { connect } from 'react-redux'
Expand All @@ -22,7 +23,7 @@ const getContentItems = (item) =>
array.findIndex((el) => el.id === item.id) === index
)

const ListItem = ({ item, dashboardMode, removeItem, updateItem }) => {
const ListItem = ({ item, dashboardMode, removeItem, updateItem, isFS }) => {
const { baseUrl } = useConfig()
const contentItems = getContentItems(item)

Expand Down Expand Up @@ -75,7 +76,11 @@ const ListItem = ({ item, dashboardMode, removeItem, updateItem }) => {
/>
<Divider margin={`0 0 ${spacers.dp4} 0`} />
<div className="dashboard-item-content">
<ul className={classes.list}>
<ul
className={cx(classes.list, {
[classes.isFS]: isFS,
})}
>
{contentItems.map((contentItem) => (
<li className={classes.item} key={contentItem.id}>
<span className={classes.itemContent}>
Expand All @@ -86,12 +91,14 @@ const ListItem = ({ item, dashboardMode, removeItem, updateItem }) => {
))}
</ul>
</div>
{isFS && <div className={classes.fsControlsBuffer} />}
</>
)
}

ListItem.propTypes = {
dashboardMode: PropTypes.string,
isFS: PropTypes.bool,
item: PropTypes.object,
removeItem: PropTypes.func,
updateItem: PropTypes.func,
Expand Down
10 changes: 10 additions & 0 deletions src/components/Item/ListItem/Item.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@
outline: none;
color: var(--colors-red800);
}

.fsControlsBuffer {
block-size: 40px;
inline-size: 100%;
}

.isFS {
padding-inline-start: 24px;
padding-inline-end: 24px;
}
2 changes: 2 additions & 0 deletions src/components/styles/ItemGrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
.react-grid-item.edit,
.react-grid-item.EVENT_VISUALIZATION,
.react-grid-item.RESOURCES,
.react-grid-item.REPORTS,
.react-grid-item.TEXT,
.react-grid-item.MESSAGES,
.react-grid-item.APP {
Expand Down Expand Up @@ -93,6 +94,7 @@

.react-grid-item.edit .dashboard-item-content,
.react-grid-item.RESOURCES .dashboard-item-content,
.react-grid-item.REPORTS .dashboard-item-content,
.react-grid-item.TEXT .dashboard-item-content,
.react-grid-item.MESSAGES .dashboard-item-content {
flex: 1;
Expand Down

0 comments on commit fd265f9

Please sign in to comment.