Skip to content

Commit

Permalink
Make code card collapsible
Browse files Browse the repository at this point in the history
  • Loading branch information
cephalization committed Dec 30, 2024
1 parent 57d06ab commit ac1cc3d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions app/src/pages/prompt/PromptCodeExportCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { useMemo, useState } from "react";
import { useFragment } from "react-relay";
import { graphql } from "relay-runtime";

import { Card } from "@arizeai/components";
import { Accordion, AccordionItem, Card } from "@arizeai/components";

import { CopyToClipboardButton, Flex } from "@phoenix/components";
import { CopyToClipboardButton, Flex, View } from "@phoenix/components";
import {
CodeLanguage,
CodeLanguageRadioGroup,
Expand Down Expand Up @@ -65,18 +65,25 @@ export function PromptCodeExportCard({
<Card
title="Code"
variant="compact"
bodyStyle={{ padding: 0 }}
extra={
<Flex gap="size-100">
<CodeLanguageRadioGroup language={language} onChange={setLanguage} />
<CopyToClipboardButton text={snippet} />
</Flex>
}
>
{language === "Python" ? (
<PythonBlock value={snippet} />
) : language === "TypeScript" ? (
<TypeScriptBlock value={snippet} />
) : null}
<Accordion>
<AccordionItem title="Snippet" id="snippet">
<View padding="size-100">
{language === "Python" ? (
<PythonBlock value={snippet} />
) : language === "TypeScript" ? (
<TypeScriptBlock value={snippet} />
) : null}
</View>
</AccordionItem>
</Accordion>
</Card>
);
}

0 comments on commit ac1cc3d

Please sign in to comment.