-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add suffix to program select options with dimension count
- Loading branch information
1 parent
bb810d1
commit 22d072e
Showing
3 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/components/MainSidebar/ProgramDimensionsPanel/SingleSelectOptionWithSuffix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Tag } from '@dhis2/ui' | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import styles from './SingleSelectOptionWithSuffix.module.css' | ||
|
||
export const SingleSelectOptionWithSuffix = ({ | ||
label, | ||
active, | ||
disabled, | ||
onClick, | ||
value, | ||
dataTest, | ||
suffix, | ||
}) => ( | ||
<div | ||
className={cx(styles.option, { | ||
[styles.disabled]: disabled, | ||
[styles.active]: active, | ||
})} | ||
onClick={(e) => onClick({}, e)} | ||
data-value={value} | ||
data-label={label} | ||
data-test={dataTest} | ||
> | ||
{label} | ||
{suffix && <Tag className={styles.tag}>{suffix}</Tag>} | ||
</div> | ||
) | ||
|
||
SingleSelectOptionWithSuffix.propTypes = { | ||
label: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
active: PropTypes.bool, | ||
dataTest: PropTypes.string, | ||
disabled: PropTypes.bool, | ||
suffix: PropTypes.string, | ||
onClick: PropTypes.func, | ||
} |
36 changes: 36 additions & 0 deletions
36
src/components/MainSidebar/ProgramDimensionsPanel/SingleSelectOptionWithSuffix.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.option { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
cursor: pointer; | ||
font-size: 14px; | ||
text-decoration: none; | ||
color: var(--colors-grey900); | ||
padding-block: var(--spacers-dp8); | ||
padding-inline: var(--spacers-dp12); | ||
} | ||
|
||
.option:hover { | ||
background-color: var(--colors-grey200); | ||
} | ||
|
||
.option:active, | ||
.option.active { | ||
background-color: var(--colors-teal700); | ||
color: var(--colors-white); | ||
cursor: auto; | ||
} | ||
|
||
.option.disabled { | ||
color: var(--colors-grey500); | ||
cursor: not-allowed; | ||
user-select: none; | ||
} | ||
|
||
.option.disabled:hover { | ||
background-color: initial; | ||
} | ||
|
||
.tag { | ||
margin-left: var(--spacers-dp12); | ||
} |