Skip to content

Commit b7a1cae

Browse files
committed
feat(ui): add ui-components package
1 parent 344da5b commit b7a1cae

File tree

165 files changed

+2320
-1467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+2320
-1467
lines changed

apps/site/app/[locale]/next-data/og/route.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import HexagonGrid from '@node-core/ui-components/Icons/HexagonGrid';
2+
import JsIconWhite from '@node-core/ui-components/Icons/Logos/JsIconWhite';
13
import { ImageResponse } from 'next/og';
24

3-
import HexagonGrid from '@/components/Icons/HexagonGrid';
4-
import JsIconWhite from '@/components/Icons/Logos/JsIconWhite';
55
import {
66
ENABLE_STATIC_EXPORT,
77
VERCEL_ENV,

apps/site/components/Common/Badge.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import AbstractBadge from '@node-core/ui-components/Common/Badge';
2+
import type { BadgeProps } from '@node-core/ui-components/Common/Badge';
3+
import type { FC } from 'react';
4+
5+
import Link from '@/components/Link';
6+
7+
const Badge: FC<BadgeProps> = props => {
8+
return <AbstractBadge linkComponent={Link} {...props} />;
9+
};
10+
11+
export default Badge;
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import { ArrowUpRightIcon } from '@heroicons/react/24/outline';
2+
import Banner from '@node-core/ui-components/Common/Banner';
23
import type { FC, PropsWithChildren } from 'react';
34

45
import Link from '@/components/Link';
56

6-
import styles from './index.module.css';
7-
87
type BannerProps = {
98
link?: string;
109
type?: 'default' | 'warning' | 'error';
1110
};
1211

13-
const Banner: FC<PropsWithChildren<BannerProps>> = ({
14-
type = 'default',
12+
const BannerWithLink: FC<PropsWithChildren<BannerProps>> = ({
13+
type,
1514
link,
1615
children,
1716
}) => (
18-
<div className={`${styles.banner} ${styles[type] || styles.default}`}>
17+
<Banner type={type}>
1918
{link ? <Link href={link}>{children}</Link> : children}
2019
{link && <ArrowUpRightIcon />}
21-
</div>
20+
</Banner>
2221
);
2322

24-
export default Banner;
23+
export default BannerWithLink;

apps/site/components/Common/BlogPostCard/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import AvatarGroup from '@node-core/ui-components/Common/AvatarGroup';
12
import { useTranslations } from 'next-intl';
23
import type { FC } from 'react';
34

4-
import AvatarGroup from '@/components/Common/AvatarGroup';
55
import FormattedTime from '@/components/Common/FormattedTime';
66
import Preview from '@/components/Common/Preview';
77
import Link from '@/components/Link';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import AbstractBreadCrumbs from '@node-core/ui-components/Common/Breadcrumbs';
2+
import type { BreadcrumbsProps } from '@node-core/ui-components/Common/Breadcrumbs';
3+
import { useTranslations } from 'next-intl';
4+
import type { FC } from 'react';
5+
6+
import Link from '@/components/Link';
7+
8+
const Breadcrumbs: FC<BreadcrumbsProps> = props => {
9+
return (
10+
<AbstractBreadCrumbs
11+
useTranslations={useTranslations}
12+
linkComponent={Link}
13+
{...props}
14+
/>
15+
);
16+
};
17+
18+
export default Breadcrumbs;
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import AbstractButton from '@node-core/ui-components/Common/Button';
2+
import type { FC, AnchorHTMLAttributes } from 'react';
3+
4+
import Link from '@/components/Link';
5+
6+
type ButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
7+
kind?: 'neutral' | 'primary' | 'secondary' | 'special';
8+
// We have an extra `disabled` prop as we simulate a button
9+
disabled?: boolean;
10+
};
11+
12+
const Button: FC<ButtonProps> = props => (
13+
<AbstractButton linkComponent={Link} {...props} />
14+
);
15+
16+
export default Button;
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use client';
2+
3+
import AbstractCodeBox from '@node-core/ui-components/Common/CodeBox';
4+
import type { CodeBoxProps } from '@node-core/ui-components/Common/CodeBox';
5+
import { useTranslations } from 'next-intl';
6+
import type { FC, PropsWithChildren } from 'react';
7+
8+
import Link from '@/components/Link';
9+
import { useCopyToClipboard, useNotification } from '@/hooks';
10+
11+
const CodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
12+
children,
13+
...props
14+
}) => {
15+
return (
16+
<AbstractCodeBox
17+
useTranslations={useTranslations}
18+
useCopyToClipboard={useCopyToClipboard}
19+
useNotification={useNotification}
20+
linkComponent={Link}
21+
{...props}
22+
>
23+
{children}
24+
</AbstractCodeBox>
25+
);
26+
};
27+
28+
export default CodeBox;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import AbstractCrossLink from '@node-core/ui-components/Common/CrossLink';
2+
import type { CrossLinkProps } from '@node-core/ui-components/Common/CrossLink';
3+
import { useTranslations } from 'next-intl';
4+
import type { FC } from 'react';
5+
6+
import Link from '@/components/Link';
7+
8+
const CrossLink: FC<CrossLinkProps> = props => {
9+
return (
10+
<AbstractCrossLink
11+
linkComponent={Link}
12+
useTranslations={useTranslations}
13+
{...props}
14+
/>
15+
);
16+
};
17+
18+
export default CrossLink;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import AbstractLanguageDropdown from '@node-core/ui-components/Common/LanguageDropDown';
2+
import type { LanguageDropDownProps } from '@node-core/ui-components/Common/LanguageDropDown';
3+
import { useTranslations } from 'next-intl';
4+
import type { FC } from 'react';
5+
6+
const LanguageDropDown: FC<LanguageDropDownProps> = props => (
7+
<AbstractLanguageDropdown useTranslations={useTranslations} {...props} />
8+
);
9+
10+
export default LanguageDropDown;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import AbstractPagination from '@node-core/ui-components/Common/Pagination';
2+
import type { PaginationProps } from '@node-core/ui-components/Common/Pagination';
3+
import { useTranslations } from 'next-intl';
4+
import type { FC } from 'react';
5+
6+
import Link from '@/components/Link';
7+
8+
const Pagination: FC<PaginationProps> = props => {
9+
return (
10+
<AbstractPagination
11+
linkComponent={Link}
12+
useTranslations={useTranslations}
13+
{...props}
14+
/>
15+
);
16+
};
17+
18+
export default Pagination;

apps/site/components/Common/Pagination/PaginationListItem/__tests__/index.test.mjs

-53
This file was deleted.

0 commit comments

Comments
 (0)