Skip to content

Commit

Permalink
feat: Description icon on front of cards
Browse files Browse the repository at this point in the history
Closes #563
  • Loading branch information
meltyshev committed Oct 22, 2024
1 parent bedd1f6 commit e0d5d7f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
12 changes: 11 additions & 1 deletion client/src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Card = React.memo(
id,
index,
name,
description,
dueDate,
isDueDateCompleted,
stopwatch,
Expand Down Expand Up @@ -106,7 +107,7 @@ const Card = React.memo(
)}
<div className={styles.name}>{name}</div>
{tasks.length > 0 && <Tasks items={tasks} />}
{(dueDate || stopwatch || notificationsTotal > 0) && (
{(description || dueDate || stopwatch || notificationsTotal > 0) && (
<span className={styles.attachments}>
{notificationsTotal > 0 && (
<span
Expand Down Expand Up @@ -135,6 +136,13 @@ const Card = React.memo(
/>
</span>
)}
{description && (
<span className={classNames(styles.attachment, styles.attachmentLeft)}>
<span className={styles.attachmentContent}>
<Icon name="align left" />
</span>
</span>
)}
</span>
)}
{users.length > 0 && (
Expand Down Expand Up @@ -221,6 +229,7 @@ Card.propTypes = {
id: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
description: PropTypes.string,
dueDate: PropTypes.instanceOf(Date),
isDueDateCompleted: PropTypes.bool,
stopwatch: PropTypes.object, // eslint-disable-line react/forbid-prop-types
Expand Down Expand Up @@ -256,6 +265,7 @@ Card.propTypes = {
};

Card.defaultProps = {
description: undefined,
dueDate: undefined,
isDueDateCompleted: undefined,
stopwatch: undefined,
Expand Down
7 changes: 7 additions & 0 deletions client/src/components/Card/Card.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
vertical-align: top;
}

.attachmentContent {
color: #6a808b;
font-size: 12px;
line-height: 20px;
padding: 0px 3px;
}

.attachmentLeft {
margin-right: 4px;
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/CardModal/CardModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const CardModal = React.memo(
{(description || canEdit) && (
<div className={styles.contentModule}>
<div className={styles.moduleWrapper}>
<Icon name="align justify" className={styles.moduleIcon} />
<Icon name="align left" className={styles.moduleIcon} />
<div className={styles.moduleHeader}>{t('common.description')}</div>
{canEdit ? (
<DescriptionEdit defaultValue={description} onUpdate={handleDescriptionUpdate}>
Expand Down
14 changes: 12 additions & 2 deletions client/src/containers/CardContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@ const makeMapStateToProps = () => {
const allLabels = selectors.selectLabelsForCurrentBoard(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);

const { name, dueDate, isDueDateCompleted, stopwatch, coverUrl, boardId, listId, isPersisted } =
selectCardById(state, id);
const {
name,
description,
dueDate,
isDueDateCompleted,
stopwatch,
coverUrl,
boardId,
listId,
isPersisted,
} = selectCardById(state, id);

const users = selectUsersByCardId(state, id);
const labels = selectLabelsByCardId(state, id);
Expand All @@ -35,6 +44,7 @@ const makeMapStateToProps = () => {
id,
index,
name,
description,
dueDate,
isDueDateCompleted,
stopwatch,
Expand Down

0 comments on commit e0d5d7f

Please sign in to comment.