Skip to content

Commit

Permalink
Merge pull request #49555 from BhuvaneshPatil/49435-change-avatar-size
Browse files Browse the repository at this point in the history
chore: change size of avatar to 100x100 for react action item created
  • Loading branch information
puneetlath authored Oct 6, 2024
2 parents 134bbd0 + 4ff1aad commit 6155703
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/components/MultipleAvatars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type MultipleAvatarsProps = {

/** Prop to limit the amount of avatars displayed horizontally */
maxAvatarsInRow?: number;

/** Prop to limit the amount of avatars displayed horizontally */
overlapDivider?: number;
};

type AvatarStyles = {
Expand All @@ -79,6 +82,7 @@ function MultipleAvatars({
shouldShowTooltip = true,
shouldUseCardBackground = false,
maxAvatarsInRow = CONST.AVATAR_ROW_SIZE.DEFAULT,
overlapDivider = 3,
}: MultipleAvatarsProps) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -167,7 +171,7 @@ function MultipleAvatars({

const oneAvatarSize = StyleUtils.getAvatarStyle(size);
const oneAvatarBorderWidth = StyleUtils.getAvatarBorderWidth(size).borderWidth ?? 0;
const overlapSize = oneAvatarSize.width / 3;
const overlapSize = oneAvatarSize.width / overlapDivider;

if (shouldStackHorizontally) {
// Height of one avatar + border space
Expand Down
14 changes: 7 additions & 7 deletions src/pages/home/report/ReportActionItemCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import ReportWelcomeText from '@components/ReportWelcomeText';
import useLocalize from '@hooks/useLocalize';
import usePolicy from '@hooks/usePolicy';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
Expand All @@ -24,14 +23,14 @@ type ReportActionItemCreatedProps = {
// eslint-disable-next-line react/no-unused-prop-types
policyID: string | undefined;
};
function ReportActionItemCreated({policyID, reportID}: ReportActionItemCreatedProps) {
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const policy = usePolicy(policyID);
function ReportActionItemCreated({reportID, policyID}: ReportActionItemCreatedProps) {
const styles = useThemeStyles();

const {translate} = useLocalize();
const {shouldUseNarrowLayout, isLargeScreenWidth} = useResponsiveLayout();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`);

if (!ReportUtils.isChatReport(report)) {
Expand Down Expand Up @@ -68,7 +67,8 @@ function ReportActionItemCreated({policyID, reportID}: ReportActionItemCreatedPr
>
<MultipleAvatars
icons={icons}
size={isLargeScreenWidth || (icons && icons.length < 3) ? CONST.AVATAR_SIZE.LARGE : CONST.AVATAR_SIZE.MEDIUM}
size={CONST.AVATAR_SIZE.XLARGE}
overlapDivider={4}
shouldStackHorizontally
shouldDisplayAvatarsInRows={shouldUseNarrowLayout}
maxAvatarsInRow={shouldUseNarrowLayout ? CONST.AVATAR_ROW_SIZE.DEFAULT : CONST.AVATAR_ROW_SIZE.LARGE_SCREEN}
Expand Down
1 change: 1 addition & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const avatarBorderWidths: Partial<Record<AvatarSizeName, number>> = {
[CONST.AVATAR_SIZE.SMALL]: 2,
[CONST.AVATAR_SIZE.SMALLER]: 2,
[CONST.AVATAR_SIZE.LARGE]: 4,
[CONST.AVATAR_SIZE.XLARGE]: 4,
[CONST.AVATAR_SIZE.MEDIUM]: 3,
[CONST.AVATAR_SIZE.LARGE_BORDERED]: 4,
};
Expand Down

0 comments on commit 6155703

Please sign in to comment.