Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ReportActionContextMenu up for grouped ReportActionItems #1948

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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