Skip to content

Commit 777fd73

Browse files
authored
added scale tags in template cards #278 (#282)
1 parent 945263a commit 777fd73

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

src/components/Templates/TemplateCard.tsx

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,43 @@ const TemplateCard: React.FC<TemplateItem> = ({ title, logo, description, type,
2020
}
2121
: {};
2222

23+
const tags = type
24+
.split(',')
25+
.map(t => t.trim())
26+
.filter(Boolean)
27+
2328
return (
24-
<Wrapper {...wrapperProps} className={styles.card}>
25-
<div className={styles.header}>
26-
<div className={styles.logo}>
27-
<img
28-
src={logo}
29-
alt={`${title} logo`}
30-
className={styles.logoImg}
31-
/>
29+
<Wrapper {...wrapperProps} className={styles.card}>
30+
<div className={styles.header}>
31+
<div className={styles.logo}>
32+
<img
33+
src={logo}
34+
alt={`${title} logo`}
35+
className={styles.logoImg}
36+
/>
37+
</div>
38+
{partner && (
39+
<span className={styles.partnerLabel}>
40+
Partner Template
41+
</span>
42+
)}
3243
</div>
33-
{partner && (
34-
<span className={styles.partnerLabel}>
35-
Partner Template
36-
</span>
37-
)}
38-
</div>
3944

40-
<div className={styles.content}>
41-
<div className={styles.text}>
42-
<div className={styles.title}>{title}</div>
43-
<div className={styles.description}>{description}</div>
45+
<div className={styles.content}>
46+
<div className={styles.text}>
47+
<div className={styles.title}>{title}</div>
48+
<div className={styles.description}>{description}</div>
49+
</div>
50+
<div className={styles.tagsContainer}>
51+
{tags.map((tag, i) => (
52+
<scale-tag color="teal" key={i}>
53+
<span className={styles.type}>{tag}</span>
54+
</scale-tag>
55+
))}
56+
</div>
4457
</div>
45-
<span className={styles.type}>{type}</span>
46-
</div>
47-
</Wrapper>
48-
);
58+
</Wrapper>
59+
);
4960

5061
};
5162

src/components/Templates/styles.module.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,16 @@ html[data-theme='dark'] .card {
132132
--text-weak: var(--ifm-color-emphasis-200);
133133
--shadow-hover: 0px 16px 64px 0px #e20074, 0px 8px 16px 0px #e20074;
134134
--telekom-shadow-raised-hover: 0px 16px 64px 0px #e20074, 0px 8px 16px 0px #e20074;
135+
}
136+
137+
.tagsContainer {
138+
display: flex;
139+
flex-wrap: nowrap; /* never wrap onto a second line */
140+
column-gap: 0.4rem; /* horizontal gap only */
141+
overflow-x: auto; /* scroll if they overflow */
142+
}
143+
144+
.tagsContainer :global(scale-tag) {
145+
display: inline-flex; /* reset any block-level margins */
146+
margin: 0; /* remove leftover bottom-margins */
135147
}

0 commit comments

Comments
 (0)