-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replaced material ui with capture-ui
- Loading branch information
1 parent
5a3908a
commit eb2493c
Showing
16 changed files
with
154 additions
and
36 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
2 changes: 1 addition & 1 deletion
2
src/core_modules/capture-core/components/ListView/ColumnSelector/ColumnSelector.component.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
3 changes: 2 additions & 1 deletion
3
src/core_modules/capture-core/components/ListView/Menu/ListViewMenu.component.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
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
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
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
outline-width: 1px; | ||
outline-offset: 0px; | ||
} | ||
|
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
87 changes: 87 additions & 0 deletions
87
src/core_modules/capture-ui/Icons/ChevronIcon.component.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,87 @@ | ||
// @flow | ||
import React, { useState, useEffect } from 'react'; | ||
import { IconButton } from 'capture-ui'; | ||
import cx from 'classnames'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { colors, spacersNum, IconChevronUp24 } from '@dhis2/ui'; | ||
|
||
type ChevronIconProps = { | ||
open: boolean, | ||
onOpen: () => void, | ||
onClose: () => void, | ||
disabled?: boolean, | ||
...CssClasses, | ||
}; | ||
|
||
const styles = { | ||
toggleButton: { | ||
margin: `0 0 0 ${spacersNum.dp4}px`, | ||
height: '24px', | ||
borderRadius: '3px', | ||
color: colors.grey600, | ||
'&:hover': { | ||
background: colors.grey200, | ||
color: colors.grey800, | ||
}, | ||
'&.open': { | ||
animation: 'flipOpen 200ms normal forwards linear', | ||
}, | ||
'&.close': { | ||
animation: 'flipClose 200ms normal forwards linear', | ||
}, | ||
'&.closeinit': { | ||
transform: 'rotateX(180deg)', | ||
}, | ||
'&.disabled': { | ||
color: colors.grey400, | ||
cursor: 'not-allowed', | ||
}, | ||
}, | ||
'@keyframes flipOpen': { | ||
from: { transform: 'rotateX(180deg)' }, | ||
to: { transform: 'rotateX(0)' }, | ||
}, | ||
'@keyframes flipClose': { | ||
from: { transform: 'rotateX(0)' }, | ||
to: { transform: 'rotateX(180deg)' }, | ||
}, | ||
}; | ||
|
||
const ChevronIconPlain = ({ open, onOpen, onClose, disabled, classes }: ChevronIconProps) => { | ||
const [postEffectOpen, setPostEffectOpenStatus] = useState(open); | ||
const [animationsReady, setAnimationsReadyStatus] = useState(false); | ||
|
||
const handleClick = () => { | ||
if (disabled) { | ||
return null; | ||
} | ||
return open ? onClose : onOpen; | ||
}; | ||
|
||
useEffect(() => { | ||
if (!animationsReady) { | ||
setAnimationsReadyStatus(true); | ||
} | ||
|
||
setPostEffectOpenStatus(open); | ||
}, [open, animationsReady]); | ||
|
||
return ( | ||
<IconButton | ||
dataTest="widget-open-close-toggle-button" | ||
className={cx(classes.toggleButton, { | ||
closeinit: !animationsReady && !postEffectOpen, | ||
open: animationsReady && postEffectOpen, | ||
close: animationsReady && !postEffectOpen, | ||
disabled, | ||
})} | ||
onClick={handleClick} | ||
disabled={disabled} | ||
> | ||
<IconChevronUp24 /> | ||
</IconButton> | ||
); | ||
}; | ||
|
||
export const ChevronIcon = withStyles(styles)(ChevronIconPlain); | ||
|
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