-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Show "more button" disabled instead of hiding it (#323)
* Disable "show more" button instead of hiding it * Update snapshot * Update styles according to the latest specs
- Loading branch information
Showing
5 changed files
with
80 additions
and
28 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
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
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 |
---|---|---|
@@ -1,30 +1,40 @@ | ||
import React from 'react'; | ||
import i18n from '@dhis2/d2-i18n'; | ||
import { colors } from '@dhis2/ui-core'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
|
||
import { colors } from '../../modules/colors'; | ||
|
||
export const SHOWMORE_BAR_HEIGHT = 16; | ||
|
||
const styles = { | ||
showMore: { | ||
color: colors.royalBlue, | ||
color: colors.grey700, | ||
cursor: 'pointer', | ||
fontSize: 11, | ||
fontWeight: 700, | ||
height: SHOWMORE_BAR_HEIGHT, | ||
paddingTop: 5, | ||
textTransform: 'uppercase', | ||
visibility: 'visible', | ||
'&:hover': { | ||
textDecoration: 'underline', | ||
}, | ||
}, | ||
disabled: { | ||
paddingTop: 5, | ||
color: colors.grey500, | ||
fontSize: 11, | ||
cursor: 'not-allowed', | ||
}, | ||
}; | ||
|
||
export const ShowMoreButton = ({ onClick, isMaxHeight, classes }) => ( | ||
<div style={{ textAlign: 'center' }}> | ||
<div className={classes.showMore} onClick={onClick}> | ||
{isMaxHeight ? i18n.t('Show less') : i18n.t('Show more')} | ||
export const ShowMoreButton = ({ onClick, isMaxHeight, classes, disabled }) => { | ||
return ( | ||
<div style={{ textAlign: 'center' }}> | ||
{disabled ? ( | ||
<div className={classes.disabled}>{i18n.t('Show more')}</div> | ||
) : ( | ||
<div className={classes.showMore} onClick={onClick}> | ||
{isMaxHeight ? i18n.t('Show less') : i18n.t('Show more')} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
); | ||
}; | ||
|
||
export default withStyles(styles)(ShowMoreButton); |
1 change: 0 additions & 1 deletion
1
src/components/ControlBar/__tests__/ConfirmDeleteDialog.spec.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
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