Skip to content

Commit

Permalink
feat(nx-dev): change code-fences and code-output styles (#16649)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcabanes authored Apr 28, 2023
1 parent 38be288 commit 0739bbb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
14 changes: 7 additions & 7 deletions nx-dev/ui-markdoc/src/lib/nodes/fence.component.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
CheckCircleIcon,
ClipboardDocumentCheckIcon,
ClipboardDocumentIcon,
InformationCircleIcon,
} from '@heroicons/react/24/outline';
import React, { ReactNode, useEffect, useState } from 'react';
// @ts-ignore
import { CopyToClipboard } from 'react-copy-to-clipboard';
// @ts-ignore
import SyntaxHighlighter from 'react-syntax-highlighter';
import { CodeOutput } from './fences/codeOutput.component';
import { CodeOutput } from './fences/code-output.component';
import { TerminalOutput } from './fences/terminal-output.component';

function resolveLanguage(lang: string) {
Expand Down Expand Up @@ -74,7 +74,7 @@ export function Fence({
children.includes('@nx/') || command.includes('@nx/');
return (
<div className="my-8 w-full">
<div className="code-block group relative inline-flex w-auto min-w-[50%] max-w-full">
<div className="code-block group relative w-full">
<div>
<CopyToClipboard
text={children}
Expand All @@ -84,7 +84,7 @@ export function Fence({
>
<button
type="button"
className="not-prose absolute top-0 right-0 z-10 flex rounded-tr-lg border border-slate-200 bg-slate-50/50 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:border-slate-700 dark:bg-slate-800"
className="not-prose absolute top-0 right-0 z-10 flex rounded-tr-lg border border-slate-200 bg-slate-50/50 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:border-slate-700 dark:bg-slate-800/60"
>
{copied ? (
<ClipboardDocumentCheckIcon className="h-5 w-5 text-blue-500 dark:text-sky-500" />
Expand All @@ -106,12 +106,12 @@ export function Fence({
/>
{showRescopeMessage && (
<a
className="relative block rounded-b-md border border-green-100 bg-green-50 px-4 py-2 text-xs font-medium text-green-600 no-underline hover:underline dark:border-green-900 dark:bg-green-900/30 dark:text-green-400"
className="relative block rounded-b-md border border-slate-200 bg-slate-50 px-4 py-2 text-xs font-medium no-underline hover:underline dark:border-slate-700 dark:bg-slate-800"
href="/recipes/other/rescope"
title="Nx 16 package name changes"
>
<CheckCircleIcon
className="mr-2 inline-block h-5 w-5 text-green-500 dark:text-green-400"
<InformationCircleIcon
className="mr-2 inline-block h-5 w-5"
aria-hidden="true"
/>
Nx 15 and lower use @nrwl/ instead of @nx/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { cx } from '@nx/nx-dev/ui-primitives';
import { ReactNode } from 'react';

export function CodeOutput({
Expand All @@ -11,10 +12,10 @@ export function CodeOutput({
}): JSX.Element {
return (
<div
className={
'hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60 ' +
(isMessageBelow ? 'rounded-t-lg border-b-0' : 'rounded-lg')
}
className={cx(
'hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60',
isMessageBelow ? 'rounded-t-lg border-b-0' : 'rounded-lg'
)}
>
{!!fileName && (
<div className="flex border-b border-slate-200 bg-slate-50 px-4 py-2 italic text-slate-400 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-500">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { cx } from '@nx/nx-dev/ui-primitives';
import { ReactNode } from 'react';

export function TerminalOutput({
Expand All @@ -13,10 +14,10 @@ export function TerminalOutput({
}): JSX.Element {
return (
<div
className={
'coding not-prose overflow-hidden border border-slate-200 bg-slate-50 font-mono text-sm leading-normal subpixel-antialiased dark:border-slate-700 dark:bg-slate-800 ' +
(isMessageBelow ? 'rounded-t-lg border-b-0' : 'rounded-lg')
}
className={cx(
'hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60',
isMessageBelow ? 'rounded-t-lg border-b-0' : 'rounded-lg'
)}
>
<div className="relative flex justify-center border-b border-slate-200 bg-slate-100/50 p-2 text-slate-400 dark:border-slate-700 dark:bg-slate-700/50 dark:text-slate-500">
<div className="absolute left-2 top-3 flex items-center gap-2">
Expand Down

1 comment on commit 0739bbb

@vercel
Copy link

@vercel vercel bot commented on 0739bbb Apr 28, 2023

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-nrwl.vercel.app
nx.dev
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app

Please sign in to comment.