-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graph): decouple graph client from nx.dev <Fence> component (#21186
- Loading branch information
Showing
34 changed files
with
133 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# graph-ui-code-block | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test graph-ui-code-block` to execute the unit tests via [Jest](https://jestjs.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
testEnvironment: 'jsdom', | ||
displayName: 'graph-ui-code-block', | ||
preset: '../../jest.preset.js', | ||
transform: { | ||
'^.+\\.[tj]sx?$': 'babel-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../coverage/graph/ui-graph', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { JsonCodeBlock } from './lib/json-code-block'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { | ||
ClipboardDocumentCheckIcon, | ||
ClipboardDocumentIcon, | ||
InformationCircleIcon, | ||
SparklesIcon, | ||
} from '@heroicons/react/24/outline'; | ||
// @ts-ignore | ||
import { CopyToClipboard } from 'react-copy-to-clipboard'; | ||
// @ts-ignore | ||
import SyntaxHighlighter from 'react-syntax-highlighter'; | ||
import { Children, JSX, ReactNode, useEffect, useState } from 'react'; | ||
import { twMerge } from 'tailwind-merge'; | ||
|
||
export function JsonCodeBlockPreTag({ | ||
children, | ||
}: { | ||
children: ReactNode; | ||
}): JSX.Element { | ||
return ( | ||
<div | ||
className={twMerge( | ||
'hljs not-prose w-full overflow-x-auto', | ||
'font-mono text-sm', | ||
'border border-slate-200 bg-slate-50/50 dark:border-slate-700 dark:bg-slate-800/60' | ||
)} | ||
> | ||
<div className="p-4">{children}</div> | ||
</div> | ||
); | ||
} | ||
|
||
export function JsonCodeBlock(props: { children: ReactNode }): JSX.Element { | ||
const [copied, setCopied] = useState(false); | ||
useEffect(() => { | ||
if (!copied) return; | ||
const t = setTimeout(() => { | ||
setCopied(false); | ||
}, 3000); | ||
return () => clearTimeout(t); | ||
}, [copied]); | ||
return ( | ||
<div className="code-block group relative w-full"> | ||
<div className="absolute top-0 right-0 z-10 flex"> | ||
<CopyToClipboard | ||
text={props.children} | ||
onCopy={() => { | ||
setCopied(true); | ||
}} | ||
> | ||
<button | ||
type="button" | ||
className={twMerge( | ||
'not-prose flex', | ||
'border border-slate-200 bg-slate-50/50 p-2 dark:border-slate-700 dark:bg-slate-800/60', | ||
'opacity-0 transition-opacity group-hover:opacity-100' | ||
)} | ||
> | ||
{copied ? ( | ||
<ClipboardDocumentCheckIcon className="h-5 w-5 text-blue-500 dark:text-sky-500" /> | ||
) : ( | ||
<ClipboardDocumentIcon className="h-5 w-5" /> | ||
)} | ||
</button> | ||
</CopyToClipboard> | ||
</div> | ||
<SyntaxHighlighter | ||
useInlineStyles={false} | ||
showLineNumbers={false} | ||
language="json" | ||
children={props.children} | ||
PreTag={JsonCodeBlockPreTag} | ||
/> | ||
</div> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# shared-ui-fence | ||
# nx-dev-ui-fence | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test shared-ui-fence` to execute the unit tests via [Jest](https://jestjs.io). | ||
Run `nx test nx-dev-ui-fence` to execute the unit tests via [Jest](https://jestjs.io). |
4 changes: 2 additions & 2 deletions
4
nx-dev/shared-ui-fence/jest.config.ts → nx-dev/ui-fence/jest.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'shared-ui-fence', | ||
displayName: 'nx-dev-ui-fence', | ||
preset: '../../jest.preset.js', | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../coverage/nx-dev/shared-ui-fence', | ||
coverageDirectory: '../../coverage/nx-dev/ui-fence', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { Fence, FenceProps } from './lib/fence'; | ||
export { TerminalOutput } from './lib/fences/terminal-output'; | ||
export { TerminalShellWrapper } from './lib/fences/terminal-shell'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../src/lib/fences/code-output.component.tsx → ...v/ui-fence/src/lib/fences/code-output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../lib/fences/terminal-output.component.tsx → ...-fence/src/lib/fences/terminal-output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/lib/fences/terminal-shell.component.tsx → ...i-fence/src/lib/fences/terminal-shell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...v/shared-ui-selector/src/lib/selector.tsx → nx-dev/ui-fence/src/lib/selector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8ccf327
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx.dev
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app