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,11 +55,9 @@ export const CodeBlock = memo(function CodeBlock({
</div> </div>
); );
const CodeContent = () => {
if (!language) {
if (typeof children === "string") { if (typeof children === "string") {
return ( return (
<code <span
className={` className={`
font-mono font-mono
text-gray-800 text-gray-800
@@ -67,20 +65,23 @@ export const CodeBlock = memo(function CodeBlock({
border border
border-gray-300 border-gray-300
rounded rounded
align-bottom
px-1 px-1
py-[3px] py-[3px]
text-xs text-xs
inline-block
whitespace-pre-wrap whitespace-pre-wrap
break-words break-words
overflow-hidden
mb-1
${className} ${className}
`} `}
> >
{children} {children}
</code> </span>
); );
} }
const CodeContent = () => {
if (!language) {
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,