Skip to content

add feature to have two icons at the same time#336

Merged
u12206050 merged 6 commits intomainfrom
bccBadge/add-dual-icons
Aug 14, 2025
Merged

add feature to have two icons at the same time#336
u12206050 merged 6 commits intomainfrom
bccBadge/add-dual-icons

Conversation

@BradleySchapf
Copy link
Member

Change summary

without making breaking changes for previous versions

Change type

  • No review
  • Small PR
  • Big PR
  • Refactor

Closes #ISSUE_NUMBER or Part of #ISSUE_NUMBER

This comment was marked as outdated.

u12206050 and others added 5 commits August 14, 2025 12:17
@BradleySchapf BradleySchapf requested a review from Copilot August 14, 2025 12:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for displaying two icons simultaneously in the BccBadge component - one on the left and one on the right side of the badge text.

  • Modified the iconRight prop to accept either a boolean or a VueComponent, enabling it to serve as both a positioning flag and an icon definition
  • Added computed logic to determine when the right icon should be displayed
  • Updated the template to render separate left and right icon components with proper ordering

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


const shouldShowRightIcon = computed(() => {
return (props.iconRight && typeof props.iconRight !== 'boolean') || (props.icon && props.iconRight === true)
})
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The logic for determining when to show the right icon is complex and could be simplified. Consider extracting the conditions into separate boolean variables with descriptive names like hasCustomRightIcon and hasIconMovedRight for better readability.

Suggested change
})
const hasCustomRightIcon = computed(() => props.iconRight && typeof props.iconRight !== 'boolean');
const hasIconMovedRight = computed(() => props.icon && props.iconRight === true);
const shouldShowRightIcon = computed(() => hasCustomRightIcon.value || hasIconMovedRight.value);

Copilot uses AI. Check for mistakes.
<div class="bcc-badge" :class="[BCC_CONTEXTS[context], contrast, size, { bordered }]">
<component
v-if="icon"
v-if="icon && iconRight !== true"
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition iconRight !== true is checking against a prop that can now be a boolean or VueComponent. This logic could be clearer by explicitly checking the type or using a computed property to determine when the left icon should be shown.

Copilot uses AI. Check for mistakes.
@u12206050 u12206050 merged commit 42cdf82 into main Aug 14, 2025
4 of 6 checks passed
@u12206050 u12206050 deleted the bccBadge/add-dual-icons branch August 14, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants