Skip to content

Commit 7237e4f

Browse files
committed
feat: add PlatformBadges component and associated styles for enhanced platform representation
1 parent 1abe7e2 commit 7237e4f

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

.markdownlint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MD013: false
44
MD014: false
55
MD024: false
66
MD031: false
7+
MD033: false
78
MD040: false
89
MD041: false
910
MD046: false
10-

src/components/PlatformBadges.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import clsx from 'clsx'; // Optional: for conditional classes if needed
3+
4+
// Map platform names (lowercase) to their CSS classes for styling
5+
const platformClasses = {
6+
twitch: 'twitch',
7+
kick: 'kick',
8+
youtube: 'youtube',
9+
};
10+
11+
export default function PlatformBadges({ supported }) {
12+
if (!supported || supported.length === 0) {
13+
return null; // Don't render anything if no platforms are specified
14+
}
15+
16+
return (
17+
<div className="platform-badge-container">
18+
{supported.map((platform) => {
19+
// Ensure platform name is lowercase for class matching
20+
const platformKey = platform.toLowerCase();
21+
const platformClass = platformClasses[platformKey] || ''; // Get specific class
22+
23+
return (
24+
<span
25+
key={platform}
26+
// Combine base badge class, our sizing class, and the specific platform class
27+
className={clsx('badge', 'platform-badge', platformClass)}
28+
>
29+
{platform} {/* Display the platform name */}
30+
</span>
31+
);
32+
})}
33+
</div>
34+
);
35+
}

src/css/custom.css

+29
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,32 @@ code {
2525
--ifm-color-primary-lightest: #4fddbf;
2626
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
2727
}
28+
29+
/* Additions for platform badges */
30+
.platform-badge {
31+
padding: 0.1em 0.4em; /* Adjust padding */
32+
font-size: 0.75em; /* Adjust font size */
33+
margin-left: 5px; /* Add some space */
34+
vertical-align: middle; /* Align nicely with the title */
35+
border-radius: 4px; /* Slightly rounded corners */
36+
font-weight: 600; /* Make text slightly bolder */
37+
}
38+
39+
/* Platform-specific colors */
40+
.platform-badge.twitch {
41+
background-color: #9146FF;
42+
color: white;
43+
}
44+
.platform-badge.kick {
45+
background-color: #53FC18;
46+
color: black;
47+
}
48+
.platform-badge.youtube {
49+
background-color: #FF0000;
50+
color: white;
51+
}
52+
53+
.platform-badge-container {
54+
margin-top: -0.5em; /* Adjust this value to fine-tune vertical spacing */
55+
margin-bottom: 1em; /* Ensure some space before the Overview section */
56+
}

0 commit comments

Comments
 (0)