Skip to content

Commit

Permalink
Merge pull request #5676 from kiva/MP-1045-fe-remove-extra-whitespace…
Browse files Browse the repository at this point in the history
…-around-badge-icons-in-my-kiva-hero-badge

fix: adjust spacing and sizing in badge tile for MyKiva
  • Loading branch information
dyersituations authored Nov 12, 2024
2 parents 0fec833 + 834a96b commit 5041dc0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
38 changes: 38 additions & 0 deletions .storybook/stories/BadgeTile.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import BadgeTile from '#src/components/MyKiva/BadgeTile.vue';
import {
badgeWomensEquality,
badgeUsEconomicEquality,
badgeClimateAction,
badgeRefugeeEquality,
badgeBasicNeeds,
} from '../mock-data/badge-journey-data-mock';

export default {
title: 'MyKiva/Badge Tile',
component: BadgeTile,
};

const story = (args) => {
const template = (_args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { BadgeTile },
setup() { return { args }; },
template: `
<div class="tw-bg-secondary tw-p-4">
<BadgeTile v-bind="args" />
</div>
`,
});
template.args = args;
return template;
};

export const WomensEquality = story({ badgesData: [badgeWomensEquality] });

export const UsEconomicEquality = story({ badgesData: [badgeUsEconomicEquality] });

export const ClimateAction = story({ badgesData: [badgeClimateAction] });

export const RefugeeEquality = story({ badgesData: [badgeRefugeeEquality] });

export const BasicNeeds = story({ badgesData: [badgeBasicNeeds] });
15 changes: 8 additions & 7 deletions src/components/MyKiva/BadgeTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
you’re almost there
</h4>
<div
class="tw-bg-white tw-p-2 tw-rounded md:tw-w-1/2 tw-cursor-pointer"
class="tw-bg-white tw-p-1.5 tw-rounded md:tw-w-1/2 tw-cursor-pointer"
@click="badgeClicked"
>
<div class="tw-flex tw-items-center tw-gap-2">
Expand All @@ -18,18 +18,19 @@
:status="BADGE_IN_PROGRESS"
:shape="badgeShape"
class="tw-z-1"
:class="{ '-tw-ml-1 -tw-mr-1.5': badgeShape === BADGE_SHAPE_OBLONG }"
>
<img
:src="tierData.contentfulData.imageUrl"
alt="Badge"
style="height: 133px; width: 133px;"
style="height: 72px; width: 72px;"
>
</BadgeContainer>
<div>
<p class="tw-font-medium">
{{ tierData.tierName }}
</p>
<p class="tw-text-small">
<p class="tw-text-small -tw-mt-0.5">
{{ tierCaption }}
</p>
<button
Expand All @@ -53,7 +54,7 @@
import { mdiArrowRight } from '@mdi/js';
import { defaultBadges } from '#src/util/achievementUtils';
import { indexIn } from '#src/util/comparators';
import { BADGE_IN_PROGRESS, getBadgeShape } from '#src/composables/useBadgeModal';
import { BADGE_IN_PROGRESS, BADGE_SHAPE_OBLONG, getBadgeShape } from '#src/composables/useBadgeModal';
import useBadgeData from '#src/composables/useBadgeData';
import BadgeContainer from '#src/components/MyKiva/BadgeContainer';
import KvMaterialIcon from '@kiva/kv-components/vue/KvMaterialIcon';
Expand Down Expand Up @@ -149,9 +150,9 @@ watch(selectedTier, newVal => {
tierData.value = tierBadgeData.value;
$kvTrackEvent('portfolio', 'view', 'Earn a badge', badgeName.value, selectedTier.value.tier.level);
}
});
}, { immediate: true });
watch(badgeName, () => {
tileLoader.value = false;
});
tileLoader.value = !badgeName.value;
}, { immediate: true });
</script>

0 comments on commit 5041dc0

Please sign in to comment.