Skip to content

Commit 2d11682

Browse files
refactor(promote): remove platform badge from PromoteCard
Remove the platform badge display and adjust grid layout to a cleaner two-column structure. Update tests to verify badge removal. - Delete platformLabel function and badge markup from component - Remove badge CSS styles including responsive variants - Adjust grid-template-columns to use 2-column layout instead of 3-column - Add test assertion to ensure badge element is not rendered Co-Authored-By: Hagicode <noreply@hagicode.com> Signed-off-by: newbe36524 <newbe36524@qq.com>
1 parent abc4c9a commit 2d11682

3 files changed

Lines changed: 2 additions & 29 deletions

File tree

src/components/promote/PromoteCard.module.css

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,11 @@
109109
letter-spacing: 0.01em;
110110
}
111111

112-
.promoteCard :global(.promote-card__badge) {
113-
align-self: center;
114-
justify-self: start;
115-
border: 1px solid var(--promote-chip-border);
116-
border-radius: 999px;
117-
background: var(--promote-chip-bg);
118-
color: var(--promote-chip-text);
119-
font-size: 0.72rem;
120-
font-weight: 700;
121-
letter-spacing: 0.08em;
122-
padding: 0.38rem 0.7rem;
123-
text-transform: uppercase;
124-
white-space: nowrap;
125-
}
126-
127112
.promoteCard :global(.promote-card__body) {
128113
min-width: 0;
129114
width: 100%;
130115
display: grid;
131-
grid-template-columns: auto minmax(13rem, 0.75fr) minmax(18rem, 1.15fr);
116+
grid-template-columns: minmax(13rem, 0.8fr) minmax(18rem, 1.2fr);
132117
align-items: center;
133118
column-gap: 1rem;
134119
row-gap: 0.22rem;
@@ -222,13 +207,6 @@
222207
gap: 0.45rem;
223208
}
224209

225-
.promoteCard :global(.promote-card__badge) {
226-
max-width: max-content;
227-
font-size: 0.72rem;
228-
letter-spacing: 0.08em;
229-
padding: 0.35rem 0.65rem;
230-
}
231-
232210
.promoteCard :global(.promote-card__title) {
233211
font-size: 0.92rem;
234212
}

src/components/promote/PromoteCard.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ type PromoteCardProps = {
1414
const DEFAULT_FOOTER_SELECTOR = 'footer, [data-footer-root], .footer';
1515
const DISMISSED_PROMOTIONS_STORAGE_KEY = 'hagicode:promote-card:dismissed-signature';
1616

17-
function platformLabel(platform: string | null, locale: string | undefined) {
18-
if (platform) return platform;
19-
return getBuilderMessage(locale, 'common:promoteCard.badgeFallback');
20-
}
21-
2217
function closeLabel(locale: string | undefined) {
2318
return getBuilderMessage(locale, 'common:promoteCard.dismiss');
2419
}
@@ -123,7 +118,6 @@ export function PromoteCard({
123118
})}
124119
>
125120
<span className="promote-card__body">
126-
<span className="promote-card__badge">{platformLabel(promotion.platform, locale)}</span>
127121
<span className="promote-card__title">{promotion.title}</span>
128122
<span className="promote-card__description">{promotion.description}</span>
129123
</span>

src/components/promote/__tests__/PromoteCard.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('PromoteCard', () => {
4747
ctaLabel: activePromotion.ctaLabel,
4848
title: activePromotion.title,
4949
})}"`);
50+
expect(markup).not.toContain('promote-card__badge');
5051
});
5152

5253
it('renders nothing when no active promotion exists', () => {

0 commit comments

Comments
 (0)