Skip to content

Commit d806aa3

Browse files
committed
merge
1 parent 3a3cf30 commit d806aa3

Some content is hidden

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

48 files changed

+6988
-6568
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.yarn
1+
.yarn
22
.yarnrc.yml

.eslintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = {
2-
extends: 'next/core-web-vitals',
3-
};
1+
module.exports = {
2+
extends: 'next/core-web-vitals',
3+
};

.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
*.log
2-
.yarn/*
3-
!.yarn/releases
4-
!.yarn/plugins
5-
!.yarn/sdks
6-
node_modules
7-
.next
1+
*.log
2+
.yarn/*
3+
!.yarn/releases
4+
!.yarn/plugins
5+
!.yarn/sdks
6+
node_modules
7+
.next

.gitpod.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# This configuration file was automatically generated by Gitpod.
2-
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3-
# and commit this file to your remote git repository to share the goodness with others.
4-
5-
tasks:
6-
- init: yarn install && yarn run build
7-
command: yarn run start
8-
9-
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
tasks:
6+
- init: yarn install && yarn run build
7+
command: yarn run start
8+
9+

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pages/**/*.mdx
1+
pages/**/*.mdx

.prettierrc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{
2-
"$schema": "http://json.schemastore.org/prettierrc",
3-
"singleQuote": true,
4-
"semi": true,
5-
"printWidth": 80,
6-
"trailingComma": "all",
7-
"arrowParens": "avoid",
8-
"bracketSpacing": false,
9-
"useTabs": true,
10-
"quoteProps": "consistent"
11-
}
1+
{
2+
"$schema": "http://json.schemastore.org/prettierrc",
3+
"singleQuote": true,
4+
"semi": true,
5+
"printWidth": 80,
6+
"trailingComma": "all",
7+
"arrowParens": "avoid",
8+
"bracketSpacing": false,
9+
"useTabs": true,
10+
"quoteProps": "consistent"
11+
}

assets/BrandVectors.tsx

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

components/client.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import dynamic from 'next/dynamic';
2-
import {ReactNode} from 'react';
3-
4-
export const NoSSR = dynamic(
5-
async () => {
6-
function Component(props: {children: ReactNode}) {
7-
return <>{props.children}</>;
8-
}
9-
10-
return Component;
11-
},
12-
{ssr: false},
13-
);
1+
import dynamic from 'next/dynamic';
2+
import {ReactNode} from 'react';
3+
4+
export const NoSSR = dynamic(
5+
async () => {
6+
function Component(props: {children: ReactNode}) {
7+
return <>{props.children}</>;
8+
}
9+
10+
return Component;
11+
},
12+
{ssr: false},
13+
);

components/code.module.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.code__container [data-rehype-pretty-code-fragment] > pre {
2-
margin: 0;
3-
}
1+
.code__container [data-rehype-pretty-code-fragment] > pre {
2+
margin: 0;
3+
}

components/code.tsx

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
import {Children, ReactElement} from 'react';
2-
import clsx from 'clsx';
3-
import styles from './code.module.css';
4-
import {useCurrentLanguage} from '../context/code';
5-
6-
export interface Props {
7-
children: ReactElement[];
8-
}
9-
10-
export function Code(props: Props) {
11-
const children = Children.map(props.children, child => {
12-
const language = child.props.children.props.children.props[
13-
'data-language'
14-
] as string;
15-
16-
return {
17-
language,
18-
Component: child,
19-
};
20-
});
21-
22-
const [activeLanguage, setActiveLanguage] = useCurrentLanguage(
23-
children.map(child => child.language),
24-
);
25-
26-
return (
27-
<div
28-
className={clsx(
29-
'flex flex-col my-5 dark:bg-black rounded-lg space-y-2 p-3 border border-neutral-100 dark:border-neutral-900',
30-
styles.code__container,
31-
)}
32-
>
33-
<div className="flex max-w-full overflow-x-auto divide-x divide-neutral-100 dark:divide-neutral-800">
34-
{children.map(child => {
35-
const active = activeLanguage === child.language;
36-
37-
return (
38-
<div
39-
key={child.language}
40-
className="px-3 first-of-type:pl-0 last-of-type:pr-0"
41-
>
42-
<button
43-
className={clsx(
44-
'transition-colors px-6 py-1 text-xs uppercase tracking-widest inline-block rounded-md',
45-
{
46-
'bg-primary-500 text-primary-50 dark:bg-neutral-800':
47-
active,
48-
'hover:bg-neutral-100 dark:hover:bg-neutral-900': !active,
49-
},
50-
)}
51-
onClick={() => setActiveLanguage(child.language)}
52-
>
53-
{child.language}
54-
</button>
55-
</div>
56-
);
57-
})}
58-
</div>
59-
60-
<div>
61-
{children.map(child => {
62-
const active = activeLanguage === child.language;
63-
64-
return (
65-
<div key={child.language} className={active ? 'block' : 'hidden'}>
66-
{child.Component}
67-
</div>
68-
);
69-
})}
70-
</div>
71-
</div>
72-
);
73-
}
1+
import {Children, ReactElement} from 'react';
2+
import clsx from 'clsx';
3+
import styles from './code.module.css';
4+
import {useCurrentLanguage} from '../context/code';
5+
6+
export interface Props {
7+
children: ReactElement[];
8+
}
9+
10+
export function Code(props: Props) {
11+
const children = Children.map(props.children, child => {
12+
const language = child.props.children.props.children.props[
13+
'data-language'
14+
] as string;
15+
16+
return {
17+
language,
18+
Component: child,
19+
};
20+
});
21+
22+
const [activeLanguage, setActiveLanguage] = useCurrentLanguage(
23+
children.map(child => child.language),
24+
);
25+
26+
return (
27+
<div
28+
className={clsx(
29+
'flex flex-col my-5 dark:bg-black rounded-lg space-y-2 p-3 border border-neutral-100 dark:border-neutral-900',
30+
styles.code__container,
31+
)}
32+
>
33+
<div className="flex max-w-full overflow-x-auto divide-x divide-neutral-100 dark:divide-neutral-800">
34+
{children.map(child => {
35+
const active = activeLanguage === child.language;
36+
37+
return (
38+
<div
39+
key={child.language}
40+
className="px-3 first-of-type:pl-0 last-of-type:pr-0"
41+
>
42+
<button
43+
className={clsx(
44+
'transition-colors px-6 py-1 text-xs uppercase tracking-widest inline-block rounded-md',
45+
{
46+
'bg-primary-500 text-primary-50 dark:bg-neutral-800':
47+
active,
48+
'hover:bg-neutral-100 dark:hover:bg-neutral-900': !active,
49+
},
50+
)}
51+
onClick={() => setActiveLanguage(child.language)}
52+
>
53+
{child.language}
54+
</button>
55+
</div>
56+
);
57+
})}
58+
</div>
59+
60+
<div>
61+
{children.map(child => {
62+
const active = activeLanguage === child.language;
63+
64+
return (
65+
<div key={child.language} className={active ? 'block' : 'hidden'}>
66+
{child.Component}
67+
</div>
68+
);
69+
})}
70+
</div>
71+
</div>
72+
);
73+
}

context/code.tsx

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
import {
2-
createContext,
3-
Dispatch,
4-
ReactNode,
5-
SetStateAction,
6-
useContext,
7-
useEffect,
8-
useMemo,
9-
useState,
10-
} from 'react';
11-
12-
export const code = createContext<{
13-
value: string | null;
14-
setValue: Dispatch<SetStateAction<string | null>>;
15-
} | null>(null);
16-
17-
export function useContextLanguage() {
18-
const data = useContext(code);
19-
20-
if (!data) {
21-
throw new Error('useCurrentLanguage must be used within a CodeProvider');
22-
}
23-
24-
return data;
25-
}
26-
27-
export function useCurrentLanguage(snippetSupportedLanguages: string[]) {
28-
const context = useContextLanguage();
29-
30-
const localLanguage = snippetSupportedLanguages.includes(context.value!)
31-
? context.value
32-
: snippetSupportedLanguages[0];
33-
34-
return [localLanguage, context.setValue] as const;
35-
}
36-
37-
export function CodeProvider({children}: {children: ReactNode}) {
38-
const [value, setValue] = useState<string | null>(() =>
39-
typeof window === 'undefined'
40-
? null
41-
: window.localStorage.getItem('preferred_language'),
42-
);
43-
44-
useEffect(() => {
45-
if (typeof window === 'undefined') {
46-
return;
47-
}
48-
49-
const stored = window.localStorage.getItem('preferred_language');
50-
51-
if (stored) {
52-
setValue(stored);
53-
}
54-
}, []);
55-
56-
useEffect(() => {
57-
if (typeof window !== 'undefined' && value) {
58-
window.localStorage.setItem('preferred_language', value);
59-
}
60-
}, [value]);
61-
62-
return (
63-
<code.Provider value={useMemo(() => ({value, setValue}), [value])}>
64-
{children}
65-
</code.Provider>
66-
);
67-
}
1+
import {
2+
createContext,
3+
Dispatch,
4+
ReactNode,
5+
SetStateAction,
6+
useContext,
7+
useEffect,
8+
useMemo,
9+
useState,
10+
} from 'react';
11+
12+
export const code = createContext<{
13+
value: string | null;
14+
setValue: Dispatch<SetStateAction<string | null>>;
15+
} | null>(null);
16+
17+
export function useContextLanguage() {
18+
const data = useContext(code);
19+
20+
if (!data) {
21+
throw new Error('useCurrentLanguage must be used within a CodeProvider');
22+
}
23+
24+
return data;
25+
}
26+
27+
export function useCurrentLanguage(snippetSupportedLanguages: string[]) {
28+
const context = useContextLanguage();
29+
30+
const localLanguage = snippetSupportedLanguages.includes(context.value!)
31+
? context.value
32+
: snippetSupportedLanguages[0];
33+
34+
return [localLanguage, context.setValue] as const;
35+
}
36+
37+
export function CodeProvider({children}: {children: ReactNode}) {
38+
const [value, setValue] = useState<string | null>(() =>
39+
typeof window === 'undefined'
40+
? null
41+
: window.localStorage.getItem('preferred_language'),
42+
);
43+
44+
useEffect(() => {
45+
if (typeof window === 'undefined') {
46+
return;
47+
}
48+
49+
const stored = window.localStorage.getItem('preferred_language');
50+
51+
if (stored) {
52+
setValue(stored);
53+
}
54+
}, []);
55+
56+
useEffect(() => {
57+
if (typeof window !== 'undefined' && value) {
58+
window.localStorage.setItem('preferred_language', value);
59+
}
60+
}, [value]);
61+
62+
return (
63+
<code.Provider value={useMemo(() => ({value, setValue}), [value])}>
64+
{children}
65+
</code.Provider>
66+
);
67+
}

hop.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1
2-
config:
3-
project_id: project_NDc5NDAwODIyMDQ2OTI1MDc
4-
deployment_id: deployment_NDk3NzI5MjkyNjM0MTk0Mjg
1+
version: 1
2+
config:
3+
project_id: project_NDc5NDAwODIyMDQ2OTI1MDc
4+
deployment_id: deployment_NDk3NzI5MjkyNjM0MTk0Mjg

0 commit comments

Comments
 (0)