Inline code + effect clarity (#2715)

* cleaner code blocks + form context

* cleaner

* nit
This commit is contained in:
pablodanswer
2024-10-07 15:23:37 -07:00
committed by GitHub
parent 1a3469d2c5
commit 4214a3a6e2
3 changed files with 27 additions and 26 deletions

View File

@@ -55,32 +55,33 @@ export const CodeBlock = memo(function CodeBlock({
</div> </div>
); );
if (typeof children === "string") {
return (
<span
className={`
font-mono
text-gray-800
bg-gray-50
border
border-gray-300
rounded
align-bottom
px-1
py-[3px]
text-xs
inline-block
whitespace-pre-wrap
break-words
${className}
`}
>
{children}
</span>
);
}
const CodeContent = () => { const CodeContent = () => {
if (!language) { if (!language) {
if (typeof children === "string") {
return (
<code
className={`
font-mono
text-gray-800
bg-gray-50
border
border-gray-300
rounded
px-1
py-[3px]
text-xs
whitespace-pre-wrap
break-words
overflow-hidden
mb-1
${className}
`}
>
{children}
</code>
);
}
return ( return (
<pre style={CODE_BLOCK_PADDING}> <pre style={CODE_BLOCK_PADDING}>
<code className={`text-sm ${className}`}> <code className={`text-sm ${className}`}>

View File

@@ -74,7 +74,7 @@ export const EmbeddingFormProvider: React.FC<{
if (stepFromUrl !== formStep) { if (stepFromUrl !== formStep) {
setFormStep(stepFromUrl); setFormStep(stepFromUrl);
} }
}, [searchParams, formStep]); }, [searchParams]);
const contextValue: EmbeddingFormContextType = { const contextValue: EmbeddingFormContextType = {
formStep, formStep,

View File

@@ -73,7 +73,7 @@ export const FormProvider: React.FC<{
if (stepFromUrl !== formStep) { if (stepFromUrl !== formStep) {
setFormStep(stepFromUrl); setFormStep(stepFromUrl);
} }
}, [searchParams, formStep]); }, [searchParams]);
const contextValue: FormContextType = { const contextValue: FormContextType = {
formStep, formStep,