diff --git a/graph/client/src/styles.css b/graph/client/src/styles.css index e05ff27327..0349580f6f 100644 --- a/graph/client/src/styles.css +++ b/graph/client/src/styles.css @@ -1,3 +1,7 @@ +/*! purgecss start ignore */ +@import './syntax-highlight.css'; +/*! purgecss end ignore */ + @tailwind components; @tailwind base; @tailwind utilities; @@ -6,3 +10,37 @@ .dark { color-scheme: dark; } + +/** + * Tooltips + */ +[data-tooltip] { + position: relative; +} + +[data-tooltip]:before { + background-color: hsla(214, 61%, 11%, 1); + border-radius: 0.375rem; + color: hsla(0, 0%, 95%, 1); + content: attr(data-tooltip); + left: 0; + opacity: 0; + padding: 0.25rem 0.5rem; + position: absolute; + text-align: center; + text-transform: capitalize; + top: 120%; + transition: opacity 150ms ease-out; + visibility: hidden; + z-index: 1; + width: max-content; +} +[data-tooltip][data-tooltip-align-right]:before { + left: auto; + right: 0; +} + +[data-tooltip]:hover:before { + opacity: 1; + visibility: visible; +} diff --git a/graph/client/src/syntax-highlight.css b/graph/client/src/syntax-highlight.css new file mode 100644 index 0000000000..a69e9c62b2 --- /dev/null +++ b/graph/client/src/syntax-highlight.css @@ -0,0 +1,79 @@ +html { + --interactive-muted: #94a3b8; +} +.dark { + --interactive-muted: #64748b; +} + +.hljs .hljs-comment, +.hljs .hljs-quote { + color: var(--interactive-muted); +} + +.hljs .hljs-addition, +.hljs .hljs-keyword, +.hljs .hljs-selector-tag { + color: #859900; +} + +.hljs .hljs-doctag, +.hljs .hljs-literal, +.hljs .hljs-meta .hljs .hljs-meta-string, +.hljs .hljs-number, +.hljs .hljs-regexp, +.hljs .hljs-string { + color: #2aa198; +} + +.hljs .hljs-name, +.hljs .hljs-section, +.hljs .hljs-selector-class, +.hljs .hljs-selector-id, +.hljs .hljs-title { + color: #268bd2; +} + +.hljs .hljs-attr, +.hljs .hljs-attribute, +.hljs .hljs-class .hljs .hljs-title, +.hljs .hljs-template-variable, +.hljs .hljs-type, +.hljs .hljs-variable { + color: #b58900; +} + +.hljs .hljs-bullet, +.hljs .hljs-link, +.hljs .hljs-meta, +.hljs .hljs-meta .hljs .hljs-keyword, +.hljs .hljs-selector-attr, +.hljs .hljs-selector-pseudo, +.hljs .hljs-subst, +.hljs .hljs-symbol { + color: #cb4b16; +} + +.hljs .hljs-built_in, +.hljs .hljs-deletion { + color: #dc322f; +} + +.hljs .hljs-formula { + background: #073642; +} + +.hljs .hljs-emphasis { + font-style: italic; +} + +.hljs .hljs-strong { + font-weight: 700; +} + +.linenumber { + border-color: rgb(59 130 246); + background: #e5e7eb; +} +html.dark .linenumber { + background: #e5e7eb33; +} diff --git a/graph/project-details/src/lib/project-details-page.tsx b/graph/project-details/src/lib/project-details-page.tsx index 2c429ab826..3d90800b91 100644 --- a/graph/project-details/src/lib/project-details-page.tsx +++ b/graph/project-details/src/lib/project-details-page.tsx @@ -52,36 +52,25 @@ export function ProjectDetailsPage() {
{environment !== 'nx-console' ? ( -
-
- - Nx - - -
    -
  • - - Graph - -
  • -
  • - -
  • -
+
+
+ + + Nx + + + +
- ) : null} + ) : ( +
+ )}
+ {element} {sourceElement && ( - + {sourceElement} )} diff --git a/graph/ui-project-details/src/lib/pill.tsx b/graph/ui-project-details/src/lib/pill.tsx new file mode 100644 index 0000000000..febfb96f15 --- /dev/null +++ b/graph/ui-project-details/src/lib/pill.tsx @@ -0,0 +1,28 @@ +import { twMerge } from 'tailwind-merge'; + +export function Pill({ + text, + color = 'grey', + tooltip, +}: { + text: string; + color?: 'grey' | 'green' | 'yellow'; + tooltip?: string; +}) { + return ( + + {text} + + ); +} diff --git a/graph/ui-project-details/src/lib/project-details/project-details.tsx b/graph/ui-project-details/src/lib/project-details/project-details.tsx index 297409121d..27b0c4d75e 100644 --- a/graph/ui-project-details/src/lib/project-details/project-details.tsx +++ b/graph/ui-project-details/src/lib/project-details/project-details.tsx @@ -20,6 +20,7 @@ import { useRef, } from 'react'; import { twMerge } from 'tailwind-merge'; +import { Pill } from '../pill'; export interface ProjectDetailsProps { project: ProjectGraphProjectNode; @@ -90,34 +91,42 @@ export const ProjectDetails = forwardRef( >

- {name}{' '} - {onViewInProjectGraph ? ( - onViewInProjectGraph({ projectName: name })} - > - ) : null}{' '} + {name} + + {onViewInProjectGraph ? ( + + ) : null}{' '} +

-
- {projectData.tags ? ( +
+ {projectData.tags && projectData.tags.length ? (

+ Tags: {projectData.tags?.map((tag) => ( - - {tag} + + ))}

) : null}

- Root: {root} + Root: + {root}

{displayType ? (

- Type: {displayType} + Type: + {displayType}

) : null}
@@ -128,13 +137,13 @@ export const ProjectDetails = forwardRef( openAction="hover" content={() as any} > - + Targets