Skip to content

Commit d41a9f0

Browse files
authored
feat(server): more server components (#8239)
* feat(server): more server components * more server
1 parent 02bf873 commit d41a9f0

File tree

9 files changed

+16
-41
lines changed

9 files changed

+16
-41
lines changed
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
'use client';
2-
31
import BaseLinkTabs from '@node-core/ui-components/Common/BaseLinkTabs';
42
import type { LinkTabsProps } from '@node-core/ui-components/Common/BaseLinkTabs';
53
import type { FC } from 'react';
64

75
import Link from '#site/components/Link';
8-
import { useRouter } from '#site/navigation.mjs';
96

10-
const LinkTabs: FC<Omit<LinkTabsProps, 'as' | 'onSelect'>> = props => {
11-
const { push } = useRouter();
12-
return <BaseLinkTabs onSelect={value => push(value)} as={Link} {...props} />;
7+
const LinkTabs: FC<Omit<LinkTabsProps, 'as'>> = props => {
8+
return <BaseLinkTabs as={Link} {...props} />;
139
};
1410

1511
export default LinkTabs;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use client';
2-
31
import Avatar from '@node-core/ui-components/Common/AvatarGroup/Avatar';
42
import type { FC } from 'react';
53

apps/site/components/Downloads/DownloadButton/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
'use client';
2-
31
import { CloudArrowDownIcon } from '@heroicons/react/24/outline';
42
import classNames from 'classnames';
53
import type { FC, PropsWithChildren } from 'react';
64

5+
import { getClientContext } from '#site/client-context';
76
import Button from '#site/components/Common/Button';
8-
import { useClientContext } from '#site/hooks';
97
import type { NodeRelease } from '#site/types';
108
import { getNodeDownloadUrl } from '#site/util/url';
119
import { getUserPlatform } from '#site/util/userAgent';
@@ -18,7 +16,7 @@ const DownloadButton: FC<PropsWithChildren<DownloadButtonProps>> = ({
1816
release: { versionWithPrefix },
1917
children,
2018
}) => {
21-
const { os, bitness, architecture } = useClientContext();
19+
const { os, bitness, architecture } = getClientContext();
2220

2321
const platform = getUserPlatform(architecture, bitness);
2422
const downloadLink = getNodeDownloadUrl({ versionWithPrefix, os, platform });

apps/site/components/Downloads/DownloadLink.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
'use client';
2-
31
import type { FC, PropsWithChildren } from 'react';
42

3+
import { getClientContext } from '#site/client-context';
54
import LinkWithArrow from '#site/components/Common/LinkWithArrow';
6-
import { useClientContext } from '#site/hooks';
75
import type { DownloadKind, NodeRelease } from '#site/types';
86
import { getNodeDownloadUrl } from '#site/util/url';
97
import { getUserPlatform } from '#site/util/userAgent';
@@ -15,7 +13,7 @@ const DownloadLink: FC<PropsWithChildren<DownloadLinkProps>> = ({
1513
kind = 'installer',
1614
children,
1715
}) => {
18-
const { os, bitness, architecture } = useClientContext();
16+
const { os, bitness, architecture } = getClientContext();
1917

2018
const platform = getUserPlatform(architecture, bitness);
2119

packages/ui-components/src/Common/BaseLinkTabs/index.module.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,5 @@
3838
}
3939

4040
.tabsSelect {
41-
@apply sm:visible
42-
md:hidden;
43-
44-
> span {
45-
@apply max-xs:flex
46-
my-6
47-
hidden
48-
w-full;
49-
}
41+
@apply md:hidden;
5042
}

packages/ui-components/src/Common/BaseLinkTabs/index.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { FC, PropsWithChildren } from 'react';
22

3-
import Select from '#ui/Common/Select';
43
import type { LinkLike } from '#ui/types';
54

65
import styles from './index.module.css';
6+
import StatelessSelect from '../Select/StatelessSelect';
77

88
type LinkTab = { key: string; label: string; link: string };
99

@@ -12,7 +12,6 @@ export type LinkTabsProps = PropsWithChildren<{
1212
tabs: Array<LinkTab>;
1313
activeTab: string;
1414
as?: LinkLike;
15-
onSelect: (value: string) => void;
1615
}>;
1716

1817
const BaseLinkTabs: FC<LinkTabsProps> = ({
@@ -21,7 +20,6 @@ const BaseLinkTabs: FC<LinkTabsProps> = ({
2120
activeTab,
2221
children,
2322
as: Component = 'a',
24-
onSelect,
2523
}) => (
2624
<>
2725
<div className={styles.tabsList}>
@@ -37,14 +35,12 @@ const BaseLinkTabs: FC<LinkTabsProps> = ({
3735
))}
3836
</div>
3937

40-
<div className={styles.tabsSelect}>
41-
<Select
42-
label={label}
43-
defaultValue={tabs.find(tab => tab.key === activeTab)?.link}
44-
values={tabs.map(tab => ({ label: tab.label, value: tab.link }))}
45-
onChange={onSelect}
46-
/>
47-
</div>
38+
<StatelessSelect
39+
label={label}
40+
className={styles.tabsSelect}
41+
defaultValue={tabs.find(tab => tab.key === activeTab)?.link}
42+
values={tabs.map(tab => ({ label: tab.label, value: tab.link }))}
43+
/>
4844

4945
{children}
5046
</>

packages/ui-components/src/Common/Select/index.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@
180180
}
181181

182182
.dropdown {
183-
@apply absolute
183+
@apply z-99
184+
absolute
184185
left-0
185186
mt-4;
186187
}

packages/ui-components/src/Common/Separator/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use client';
2-
31
import * as SeparatorPrimitive from '@radix-ui/react-separator';
42
import classNames from 'classnames';
53
import type { FC, ComponentProps } from 'react';

packages/ui-components/src/Containers/NavBar/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use client';
2-
31
import Hamburger from '@heroicons/react/24/solid/Bars3Icon';
42
import XMark from '@heroicons/react/24/solid/XMarkIcon';
53
import * as Label from '@radix-ui/react-label';

0 commit comments

Comments
 (0)