Skip to content

Commit

Permalink
Move ReportActionContextMenu up for grouped ReportActionItems
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Mar 19, 2021
1 parent 2a305d6 commit 1017f44
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
10 changes: 6 additions & 4 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import {withOnyx} from 'react-native-onyx';
import CONST from '../../../CONST';
import ONYXKEYS from '../../../ONYXKEYS';
import ReportActionPropTypes from './ReportActionPropTypes';
import styles from '../../../styles/styles';
import getReportActionItemStyles from '../../../styles/getReportActionItemStyles';
import {
getReportActionItemStyle,
getMiniReportActionContextMenuWrapperStyle,
} from '../../../styles/getReportActionItemStyles';
import PressableWithSecondaryInteraction from '../../../components/PressableWithSecondaryInteraction';
import Hoverable from '../../../components/Hoverable';
import PopoverWithMeasuredContent from '../../../components/PopoverWithMeasuredContent';
Expand Down Expand Up @@ -107,12 +109,12 @@ class ReportActionItem extends Component {
<Hoverable>
{hovered => (
<View>
<View style={getReportActionItemStyles(hovered)}>
<View style={getReportActionItemStyle(hovered)}>
{!this.props.displayAsGroup
? <ReportActionItemSingle action={this.props.action} />
: <ReportActionItemGrouped action={this.props.action} />}
</View>
<View style={styles.miniReportActionContextMenuWrapperStyle}>
<View style={getMiniReportActionContextMenuWrapperStyle(this.props.displayAsGroup)}>
<ReportActionContextMenu
reportID={this.props.reportID}
reportActionID={this.props.action.sequenceNumber}
Expand Down
17 changes: 16 additions & 1 deletion src/styles/getReportActionItemStyles.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import themeColors from './themes/default';
import positioning from './utilities/positioning';

/**
* Generate the styles for the ReportActionItem wrapper view.
*
* @param {Boolean} [isHovered]
* @returns {Object}
*/
export default function (isHovered = false) {
export function getReportActionItemStyle(isHovered = false) {
return {
display: 'flex',
justifyContent: 'space-between',
backgroundColor: isHovered ? themeColors.hoverComponentBG : themeColors.componentBG,
cursor: 'default',
};
}

/**
* Generate the wrapper styles for the mini ReportActionContextMenu.
*
* @param {Boolean} isReportActionItemGrouped
* @returns {Object}
*/
export function getMiniReportActionContextMenuWrapperStyle(isReportActionItemGrouped) {
return {
...(isReportActionItemGrouped ? positioning.tn8 : positioning.tn4),
...positioning.r4,
position: 'absolute',
};
}
7 changes: 0 additions & 7 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import sizing from './utilities/sizing';
import flex from './utilities/flex';
import display from './utilities/display';
import overflow from './utilities/overflow';
import positioning from './utilities/positioning';
import whiteSpace from './utilities/whiteSpace';
import wordBreak from './utilities/wordBreak';
import textInputAlignSelf from './utilities/textInputAlignSelf';
Expand Down Expand Up @@ -953,12 +952,6 @@ const styles = {
borderColor: colors.transparent,
},

miniReportActionContextMenuWrapperStyle: {
...positioning.tn4,
...positioning.r4,
position: 'absolute',
},

reportActionContextMenuText: {
color: themeColors.heading,
fontFamily: fontFamily.GTA_BOLD,
Expand Down
3 changes: 3 additions & 0 deletions src/styles/utilities/positioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export default {
tn4: {
top: -16,
},
tn8: {
top: -32,
},
r4: {
right: 16,
},
Expand Down

0 comments on commit 1017f44

Please sign in to comment.