Skip to content
Merged
4 changes: 4 additions & 0 deletions apps/site/next.mdx.use.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

import BadgeGroup from '@node-core/ui-components/Common/BadgeGroup';

import DownloadReleasesTable from './components/Downloads/DownloadReleasesTable';
import UpcomingMeetings from './components/MDX/Calendar/UpcomingMeetings';
import WithBadgeGroup from './components/withBadgeGroup';
Expand All @@ -21,4 +23,6 @@ export const mdxComponents = {
WithBadgeGroup: WithBadgeGroup,
// Renders an container for Upcoming Node.js Meetings
UpcomingMeetings: UpcomingMeetings,
// Standalone Badge Group
BadgeGroup: BadgeGroup,
};
25 changes: 23 additions & 2 deletions apps/site/pages/en/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,36 @@ layout: home
<div className="flex gap-4">

<div className="flex flex-col gap-2">
<Button kind="special" className="!hidden dark:!block" href="/download">Install Node.js</Button>
<Button kind="special" className="!hidden dark:!block" href="/download">Get Node.</Button>
Comment thread
ovflowd marked this conversation as resolved.
Outdated

<Button kind="primary" className="!block dark:!hidden" href="/download">Install Node.js</Button>
<Button kind="primary" className="!block dark:!hidden" href="/download">Get Node.js®</Button>

<Button kind="secondary" className="!block" href="/blog/announcements/node-18-eol-support">
<span>Get security support</span>
<br />
<small className="!text-xs">for Node.js 18 and below</small>
</Button>

<div className="flex flex-row gap-2 justify-center xs:mt-6">
<WithNodeRelease status="Current">
{({ release }) =>
<BadgeGroup size="small" badgeText={release.versionWithPrefix} href={`/blog/release/${release.versionWithPrefix}`}>
Node.js Current
</BadgeGroup>}
</WithNodeRelease>

<WithNodeRelease status="LTS">
{({ release }) =>
<BadgeGroup size="small" kind="warning" badgeText={release.versionWithPrefix} href={`/blog/release/${release.versionWithPrefix}`}>
Node.js LTS
</BadgeGroup>}
</WithNodeRelease>
</div>

<span className="italic text-center text-xs! text-gray-500">
<span>"LTS" stands for the long-term support version of Node.js. </span>
Comment thread
ovflowd marked this conversation as resolved.
Outdated
<span>Learn more about Node.js releases <Link href="/about/previous-releases">here</Link>.</span>
Comment thread
ovflowd marked this conversation as resolved.
Outdated
Comment thread
ovflowd marked this conversation as resolved.
Outdated
</span>
</div>

</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-components/src/Common/Badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import type { FC, HTMLAttributes, PropsWithChildren } from 'react';
import styles from './index.module.css';

type BadgeKind = 'default' | 'warning' | 'error';
type BadgeSize = 'small' | 'medium';
Comment thread
ovflowd marked this conversation as resolved.

type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
size?: 'small' | 'medium';
size?: BadgeSize;
kind?: BadgeKind;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
dark:text-green-300;
}

.message {
.message,
.message a:not(:hover) {
Comment thread
ovflowd marked this conversation as resolved.
@apply text-green-700
dark:text-green-300;
}
Expand All @@ -52,7 +53,8 @@
dark:text-danger-300;
}

.message {
.message,
.message a:not(:hover) {
@apply text-danger-700
dark:text-danger-300;
}
Expand All @@ -69,7 +71,8 @@
dark:text-warning-300;
}

.message {
.message,
.message a:not(:hover) {
@apply text-warning-700
dark:text-warning-300;
}
Expand Down
10 changes: 10 additions & 0 deletions packages/ui-components/src/Common/BadgeGroup/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ export const Default: Story = {
},
};

export const SmallDefault: Story = {
args: {
href: '/',
children: 'OpenJS Foundation Certification 2023',
kind: 'default',
badgeText: 'New',
size: 'small',
},
};

export const Error: Story = {
args: {
href: '/',
Expand Down
10 changes: 6 additions & 4 deletions packages/ui-components/src/Common/BadgeGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,30 @@ import type { LinkLike } from '#ui/types';

import styles from './index.module.css';

type BadgeGroupKind = 'default' | 'warning' | 'error';

type BadgeGroupProps = {
kind?: BadgeGroupKind;
kind?: ComponentProps<typeof Badge>['kind'];
size?: ComponentProps<typeof Badge>['size'];
badgeText?: string;
as: LinkLike;
} & ComponentProps<LinkLike>;

const BadgeGroup: FC<PropsWithChildren<BadgeGroupProps>> = ({
kind = 'default',
size = 'medium',
badgeText,
children,
as: Component = 'a',
...args
}) => (
<Component className={`${styles.wrapper} ${styles[kind]}`} {...args}>
{badgeText && (
<Badge kind={kind} className={styles.badge}>
<Badge kind={kind} size={size} className={styles.badge}>
{badgeText}
</Badge>
)}

<span className={styles.message}>{children}</span>

{args.href && <ArrowRightIcon className={styles.icon} />}
</Component>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-components/src/styles/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ main {

&:hover {
@apply text-green-900
dark:text-green-300;
dark:text-green-200;
}

&[role='button'] {
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://turbo.build/schema.json",
"dangerouslyDisablePackageManagerCheck": true,
"ui": "tui",
Comment thread
ovflowd marked this conversation as resolved.
Outdated
"tasks": {
"//#prettier": {
"outputs": [".prettiercache"]
Expand Down
Loading