Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,42 @@
@apply font-regular
relative
z-20
mb-px
flex
w-full
items-center
overflow-hidden
rounded-md
text-sm
text-neutral-800
dark:text-neutral-200;

&:hover {
&:not(.progression) .label {
@apply rounded-sm
bg-neutral-100
text-neutral-900
dark:bg-neutral-800
dark:text-neutral-100;
}

.icon {
@apply scale-110
text-green-600
dark:text-green-400;
}

.progressionIcon {
@apply fill-green-200
dark:fill-green-300;
}
}

.label {
@apply font-regular
flex
items-center
gap-1.5
p-2
text-sm;
}
Expand All @@ -37,6 +63,12 @@
.label {
@apply p-1;
}

&:not(.active):hover .label {
@apply rounded-sm
bg-neutral-100
dark:bg-neutral-900;
}
}

&.active {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ const SidebarItem: FC<SidebarItemProps> = ({
{showProgressionIcons && (
<ProgressionIcon className={styles.progressionIcon} />
)}
<span className={styles.label}>{label}</span>

{/^https?:/.test(link) && <ArrowUpRightIcon className={styles.icon} />}
<div className={styles.label}>
<span>{label}</span>

{/^https?:/.test(link) && <ArrowUpRightIcon className={styles.icon} />}
</div>
</BaseActiveLink>
);

Expand Down
18 changes: 16 additions & 2 deletions packages/ui-components/src/MDX/CodeTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ type MDXCodeTabsProps = {
defaultTab?: string;
};

const NAME_OVERRIDES: Record<string, string | undefined> = {
mjs: 'ESM',
};

const MDXCodeTabs: FC<MDXCodeTabsProps> = ({
languages: rawLanguages,
displayNames: rawDisplayNames,
Expand All @@ -20,12 +24,22 @@ const MDXCodeTabs: FC<MDXCodeTabsProps> = ({
const languages = rawLanguages.split('|');
const displayNames = rawDisplayNames?.split('|') ?? [];

const occurrences: Record<string, number> = {};

const tabs = languages.map((language, index) => {
const displayName = displayNames[index];
const base =
displayNames[index]?.trim() ||
NAME_OVERRIDES[language] ||
language.toUpperCase();

const count = occurrences[base] ?? 0;
occurrences[base] = count + 1;

const label = count > 0 ? `${base} (${count + 1})` : base;

return {
key: `${language}-${index}`,
label: displayName?.length ? displayName : language.toUpperCase(),
label: label,
};
});

Expand Down
Loading